Skip to content

Commit

Permalink
Move twig to middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
adriansuter committed May 12, 2019
1 parent 00ed5da commit c1c6398
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@
AppFactory::setContainer($container);
$app = AppFactory::create();

$twig = new Twig(
$rootPath . '/application/templates',
[
'cache' => $rootPath . '/cache',
'auto_reload' => true,
'debug' => false,
]
);
// Add the twig middleware (which when processed would set the 'view' to the container).
$app->add(
new TwigMiddleware($twig, $container, $app->getRouteCollector()->getRouteParser(), $app->getBasePath())
new TwigMiddleware(
new Twig(
$rootPath . '/application/templates',
[
'cache' => $rootPath . '/cache',
'auto_reload' => true,
'debug' => false,
]
),
$container, $app->getRouteCollector()->getRouteParser(), $app->getBasePath())
);

$app->group('/', function (RouteCollectorProxy $group) {
Expand Down

0 comments on commit c1c6398

Please sign in to comment.