Skip to content

Instantly share code, notes, and snippets.

@geggleto
Last active January 26, 2016 22:12
Show Gist options
  • Select an option

  • Save geggleto/1599f2ab5563398ed847 to your computer and use it in GitHub Desktop.

Select an option

Save geggleto/1599f2ab5563398ed847 to your computer and use it in GitHub Desktop.
slim 3 gist 2
//Let's configure it.
// Fetch DI Container
$container = $app->getContainer();
// Register Twig View helper and configure it
$container['view'] = function ($c) {
//You can change this as you want
$view = new \Slim\Views\Twig('templates', [
'cache' => false //or specify a cache directory
]);
// Instantiate and add Slim specific extension
$view->addExtension(new Slim\Views\TwigExtension(
$c['router'],
$c['request']->getUri()
));
return $view;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment