wherd / signal
Yet another template engine
Fund package maintenance!
Other
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- kahlan/kahlan: ^5.2
- phpstan/phpstan: ^1.6
README
Yet another template engine.
Installation
Install using composer:
composer require wherd/signal
Usage
Create a signal instance by passing it the folder(s) where your view files are located. Render a template by calling the render
method.
use Wherd\Signal\Engine; $signal = new Engine(__DIR__ . '/views'); $signal->setCacheDirectory(__DIR__ . '/tmp'); echo $signal->render('homepage', ['name' => 'John Doe']);
You can also extend Singal using the directive()
function:
$signal->directive( 'datetime', fn ($expression) => "<?php echo (new DateTime($expression))->format('F d, Y g:i a'); ?>" );
Which allows you to use the following in your signal template:
Current date: @datetime($date)