1. Go to this page and download the library: Download maurice2k/zenplate library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
maurice2k / zenplate example snippets
use Maurice\Zenplate\Runner;
$runner = new Runner();
$runner->assign('name', 'Alice');
echo $runner->run('Hello {%name}!');
// => Hello Alice!
$runner->assign('s', 'hello');
$runner->run('{if strlen(%s) > 3}long{else}short{/if}'); // => long
use Maurice\Zenplate\Compiler;
$c = new Compiler();
$c->supportedIfFuncs[] = 'count';
use Maurice\Zenplate\Compiler;
$c = new Compiler();
$c->leftDelimiter = '<<';
$c->rightDelimiter = '>>';
$compiled = $c->compile('Hello <<%name>>!');
use Maurice\Zenplate\Compiler;
use Maurice\Zenplate\Runner;
$compiled = (new Compiler())->compile('Hello {%name}!');
file_put_contents('/var/cache/greeting.php', $compiled);
// Later, possibly in another request:
$runner = new Runner();
$runner->assign('name', 'Alice');
echo $runner->runCompiled(file_get_contents('/var/cache/greeting.php'));