PHP MIT

templating

Provides all the tools needed to build any kind of template system

S

symfony

Dernière activité 5 juin 2026
symfony/templating

1 k

étoiles

18

forks

0

issues ouvertes

componentphpsymfonysymfony-component

Ce README est souvent en anglais.

Templating Component

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) ?>!

Resources

Projets similaires

Provides a tight integration of Twig into the Symfony full-stack framework

PHPcomponentphpsymfony
Ssymfony
2,5 k étoiles23

Provides tools to internationalize your application

PHPcomponentphpsymfony
Ssymfony
6,6 k étoiles90

Allows to easily create, process and reuse HTML forms

PHPcomponentphpsymfony
Ssymfony
2,8 k étoiles108