nyrodev/php-template-bundle

Symfony Bundle to keep using PHP templates

v5.0 2021-08-27 19:58 UTC

This package is auto-updated.

Last update: 2024-03-12 20:58:46 UTC


README

Symfony Bundle in order to keep using PHP template

This was not tested properly, use with caution

Instalation

composer require nyrodev/php-template-bundle dev-master

Usage

As you did before on Symfony 4, simply use your php template when rendering something. Usage examples :

$this->render('Admin/template.html.php', /* ... */);
$this->render('@MyBundle/Admin/template.html.php', /* ... */);

All helpers extings on Symfony 4 was also ported, like assets, form, session, etc... It means you can still use them on your PHP templates with $view['helper']->call()

Moreover, the tag templating.helper is still working.
You can still define your own PHP template helper by simply adding this tag, just like before.

You can also implements the NyroDev\PhpTemplateBundle\Helper\HelperInterface interface in order to be available from your view using the alias return by getAlias.

Notes

PHP Form templates does NOT work.
It requires more works and it shouldn't be too much work to rewrite only these templates into Twig.

Many source code comes from the last version 4 of framework bundle. For now, the only changes made on these files have been removing deprecation notices and changing namespaces.