You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
engelsystem/src/Renderer/TwigServiceProvider.php

32 lines
917 B
PHTML

<?php
namespace Engelsystem\Renderer;
use Engelsystem\Container\ServiceProvider;
use Twig_Environment as Twig;
use Twig_LoaderInterface as TwigLoaderInterface;
class TwigServiceProvider extends ServiceProvider
{
public function register()
{
$this->registerTwigEngine();
}
protected function registerTwigEngine()
{
$viewsPath = $this->app->get('path.views');
$twigLoader = $this->app->make(TwigLoader::class, ['paths' => $viewsPath]);
$this->app->instance(TwigLoader::class, $twigLoader);
$this->app->instance(TwigLoaderInterface::class, $twigLoader);
$twig = $this->app->make(Twig::class);
$this->app->instance(Twig::class, $twig);
$twigEngine = $this->app->make(TwigEngine::class);
$this->app->instance('renderer.twigEngine', $twigEngine);
$this->app->tag('renderer.twigEngine', ['renderer.engine']);
}
}