lune / template
PHP templates
v0.1.2
2018-04-14 19:10 UTC
Requires
- php: >=7.0.0
- lune/variables: ^0.2.1
Requires (Dev)
- guzzlehttp/psr7: ^1.4
- phpunit/phpunit: ^5.5
- psr/http-message: ^1.0
Suggests
- psr/http-message: Use a psr-7 compatible library to render Http responses
This package is auto-updated.
Last update: 2024-12-24 20:59:01 UTC
README
PHP templates
Installation
Template is available on Composer
composer require lune/template
Usage
$templates = new \Lune\Template\Engine('path/to/templates'); $template = $templates->template('template.php'); $template->render();
Passing variables
There are numerous ways to pass variables:
$templates = new \Lune\Template\Engine('path/to/templates', ['foo'=>'bar']); $template = $templates->template('template.php', ['foo'=>'bar']); $template->render(['foo'=>'bar']);
Registering functions
$templates->registerFunction('error', function($message){ return sprintf('<span class="error">%s</span>', $message); });