2017 © Pedro Peláez
 

library mini-templater

A simple helper class to process variables and alternative strings

image

kovsky0/mini-templater

A simple helper class to process variables and alternative strings

  • Monday, November 27, 2017
  • by kovsky0
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

MiniTemplater class

A simple helper class to process variables and alternative strings. Based on Spintax by Jason Davis., (*1)

Installation

Install via Composer, (*2)

composer require kovsky0/mini-templater

Getting started

To get started you need to require mini-templater.php, (*3)

<?php
require_once('vendor/autoload.php');

How to use it

Processing alternatives:, (*4)

<?php
$templater = new MiniTemplater;
$example = "This is an {{example.|exemplary usage of the class.}}";
echo $templater->process($example);

Processing alternatives recursively:, (*5)

<?php
$templater = new MiniTemplater;
$example = "This is an {{example.|exemplary usage of {{the|my}} class.}}";
echo $templater->process($example);

Processing variables:, (*6)

<?php
$templater = new MiniTemplater;
$example = "This is an [[example_text]]";
$variables = array("example_text" => "exemplary usage of the class.");
echo $templater->process($example, $variables);

Processing alternatives inside variables:, (*7)

<?php
$templater = new MiniTemplater;
$example = "This is an [[example_text]]";
$variables = array("example_text" => "{{example.|exemplary usage of the class.}}");
echo $templater->process($example, $variables);

The Versions

27/11 2017

dev-master

9999999-dev

A simple helper class to process variables and alternative strings

  Sources   Download

GPL-3.0