Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Latest commit

 

History

History
38 lines (29 loc) · 869 Bytes

README.md

File metadata and controls

38 lines (29 loc) · 869 Bytes

Templating Service Provider

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