Template - PHP Library
, (*1)
Simple template engine, (*2)
Installation
Install using composer:, (*3)
$ composer require assouan/template
Usage
Get result, (*4)
$result = Template::render($file_path);
Display result, (*5)
Template::display($file_path);
Example
Template::share('bold', true);
echo Template::render(__DIR__.'/example.tpl.php');
echo Template::render(__DIR__.'/example.tpl.php', ['name' => 'Ryan']);
echo Template::render(__DIR__.'/example.tpl.php', ['name' => 'Jeanne']);
<?php if (isset($bold)): ?>
Hello <b><?=$name?></b>!
<?php else: ?>
Hello <?=$name?>!
<?php endif; ?>
<br />