symfony/templating
Provides all the tools needed to build any kind of template system
Maintainers
v6.4.24
2025-07-10 08:14 UTC
Requires
- php: >=8.1
- symfony/deprecation-contracts: ^2.5|^3
- symfony/polyfill-ctype: ~1.8
Requires (Dev)
- psr/log: ^1|^2|^3
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT c55c6f96eafa9388390d3ba099fe844f892dbcd6
- Fabien Potencier <fabien.woop@symfony.com>
- Symfony Community
This package is auto-updated.
Last update: 2026-06-05 06:25:58 UTC
README
The Templating component provides all the tools needed to build any kind of template system.
It provides an infrastructure to load template files and optionally monitor them for changes. It also provides a concrete template engine implementation using PHP with additional tools for escaping and separating templates into blocks and layouts.
Getting Started
$ composer require symfony/templating
use Symfony\Component\Templating\Loader\FilesystemLoader; use Symfony\Component\Templating\PhpEngine; use Symfony\Component\Templating\Helper\SlotsHelper; use Symfony\Component\Templating\TemplateNameParser; $filesystemLoader = new FilesystemLoader(__DIR__.'/views/%name%'); $templating = new PhpEngine(new TemplateNameParser(), $filesystemLoader); $templating->set(new SlotsHelper()); echo $templating->render('hello.php', ['firstname' => 'Fabien']); // hello.php Hello, <?= $view->escape($firstname) ?>!
