sergiors/templating-service-provider

Template engine implementation using PHP or Twig for Silex

2.0.1 2016-07-29 20:42 UTC

This package is not auto-updated.

Last update: 2024-11-09 19:38:17 UTC


README

A service to help you with template engine implementation using PHP or Twig.

Install

composer require sergiors/templating-service-provider
use Sergiors\Silex\Provider\TemplatingServiceProvider;

$app->register(new TemplatingServiceProvider(), [
    'templating.paths' => '__DIR__.'/../Resources/views/%name%' // or an array
]);

$app['templating']->render(/.../);

If you want to use Twig:

use Silex\Provider\TwigServiceProvider;
use Sergiors\Silex\Provider\TemplatingServiceProvider;

$app->register(new TwigServiceProvider(), [
    'twig.path' => __DIR__.'/../Resources/views'
]);
$app->register(new TemplatingServiceProvider());

$app['templating']->render(/.../);

Don't forget to install twig/twig and symfony/twig-bridge to use the Twig.

License

MIT