nyrodev/php-template-bundle

Symfony Bundle to keep using PHP templates

v6.0 2023-10-12 20:12 UTC

This package is auto-updated.

Last update: 2024-10-10 20:48:25 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.