This plugin integrates Twig templating engine into symfony.
Just add axis/axis-twig-plugin
dependency to your composer.json
file:
"require": {
"axis/axis-twig-plugin": "dev-master"
}
You can configure Twig environment using factories.yml
(see AxisServiceContainerPlugin).
You can use Twig directly by retrieving Twig Environment from context service container:
$twig = sfContext::getInstance()->get('twig');
$twig->loadTemplate($pathToTemplate)->render($variables);
or as symfony view by setting it as view class in module.yml
:
all:
view_class: \Axis\S1\Twig\View\Base # means BaseView
partial_view_class: \Axis\S1\Twig\View\Base # means BasePartialView
after that your application will switch to .twig templates for layouts, partials and action views.