Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/symfony/templating
Provides all the tools needed to build any kind of template system
https://github.com/symfony/templating
component php symfony symfony-component
Last synced: 15 days ago
JSON representation
Provides all the tools needed to build any kind of template system
- Host: GitHub
- URL: https://github.com/symfony/templating
- Owner: symfony
- License: mit
- Created: 2011-02-22T18:07:06.000Z (over 13 years ago)
- Default Branch: 6.4
- Last Pushed: 2024-09-25T14:26:01.000Z (about 2 months ago)
- Last Synced: 2024-10-18T16:22:04.910Z (25 days ago)
- Topics: component, php, symfony, symfony-component
- Language: PHP
- Homepage: https://symfony.com/templating
- Size: 658 KB
- Stars: 1,027
- Watchers: 5
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
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
``````php
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
---------* [Contributing](https://symfony.com/doc/current/contributing/index.html)
* [Report issues](https://github.com/symfony/symfony/issues) and
[send Pull Requests](https://github.com/symfony/symfony/pulls)
in the [main Symfony repository](https://github.com/symfony/symfony)