prowebcraft / php-template-parser
Simple Template Parser with nested conditions
dev-main
2022-06-03 12:42 UTC
Requires
- php: 8.0.*|8.1.*
- prowebcraft/dot: dev-master
Requires (Dev)
- doctrine/coding-standard: ^9.0
- infection/infection: ^0.26.10
- phpunit/phpunit: ^9.5.20
- vimeo/psalm: ^4.23.0
This package is auto-updated.
Last update: 2024-10-30 01:48:15 UTC
README
Simple Template Parser with nested conditions
Usage examples
To sign your request create signature instance
Signing request
$template = <<<TPL Hello, {{username}}! Current date is {{date}}. Year is {{date|Y}}. You are on {{#is_paid}}paid{{else}}free{{/is_paid}} plan. You have {{car.model}} by {{car.vendor}} TPL; $variables = [ 'username' => 'John', 'date' => function (string $format = 'Y-m-d') { return date($format); }, 'car' => [ 'vendor' => 'Toyota', 'model' => 'Supra', ] ]; $conditions = [ 'is_paid' => true ]; $parsedTemplate = \prowebcraft\template\Parser::parse($template, $variables, $conditions);