sabujdas94 / html-template-parser
A secure Twig-based HTML template parser for user-provided templates input.
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/sabujdas94/html-template-parser
Requires
- php: >=7.4
- twig/twig: ^3.0
Requires (Dev)
- phpunit/phpunit: ^9.6
README
You can find usage examples in the examples/ directory.
Basic Example
require 'path-to-your-package/vendor/autoload.php'; use SecureTemplateParser\SecureTemplateParser; $parser = new SecureTemplateParser(); $template = <<<EOT Hi {{ user.name }} {% if user.age > 18 %} You're eligible for adult benefits. {% else %} You're still a minor. {% endif %} EOT; $data = [ 'user' => [ 'name' => 'John Doe', 'age' => 25, ], ]; echo $parser->render($template, $data); ## License This package is open-source software licensed under the [MIT License](LICENSE).