devtheorem/php-handlebars-parser

Parse Handlebars templates to a spec-compliant AST with PHP.

dev-master 2025-05-14 18:34 UTC

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