PHP code example of bfitech / zaplate

1. Go to this page and download the library: Download bfitech/zaplate 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/ */

    

bfitech / zaplate example snippets


<p> echo $group 



 Filter {
	public function whoami($name) {
		if (is_string($name))
			return $name;
		return array_map(function($iname){
			if (stripos($iname, 'jekyll') !== false)
				return 'Mr Hyde';
			return $iname;
		}, $name);
	}
}

BFITech\ZapTemplate\Template::load('template.php', [
	'group' => "Extraordinary Gents",
	'members' => [
		'Allan Quatermain',
		'Henry Jekyll',
	],
], [
	[(new Filter), 'whoami'],
]);
txt
$ php renderer.php
<p>Extraordinary Gents</p>
<ul>
	<li>Allan Quatermain</li>
	<li>Mr Hyde</li>
</ul>
txt
$ [ ! -f template.orig.php ] && cp template.{,orig.}php
$ php -w template.orig.php | \
> html-minifier \
>   --collapse-whitespace \
>   --trim-custom-fragments > \
> template.php
txt
$ php renderer.php
<p>Extraordinary Gents</p><ul><li>Allan Quatermain</li><li>Mr Hyde</li></ul>