devtheorem / php-handlebars-parser
Parse Handlebars templates to a spec-compliant AST with PHP.
dev-master
2025-05-14 18:34 UTC
Requires
- php: >=8.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.75
- ircmaxell/php-yacc: dev-master
- jbboehr/handlebars-spec: dev-master
- phpstan/phpstan: ^2.1.14
- phpunit/phpunit: ^11.5
This package is auto-updated.
Last update: 2025-05-14 18:35:15 UTC
README
Parse Handlebars templates to a spec-compliant AST with PHP.
Installation
composer require devtheorem/php-handlebars-parser
Usage
use DevTheorem\HandlebarsParser\ParserFactory; $parser = (new ParserFactory())->create(); $template = "Hello {{name}}!"; $result = $parser->parse($template);
If the template contains invalid syntax, an exception will be thrown.
Otherwise, $result
will contain a DevTheorem\HandlebarsParser\Ast\Program
instance.
Author
Theodore Brown