I'm using Slim Framework 3 with PHP-DI/Slim-Bridge. This is my container:
$builder->addDefinitions([
'settings.displayErrorDetails' => true,
'router' => get(Router::class),
Twig::class => function(ContainerInterface $c) {
$twig = new Twig(__DIR__.'/../resources/views', [
'cache'=> false
]);
$twig->addExtension(new TwigExtension(
$c->get('router'),
$c->get('request')->getUri()
));
return $twig;
}
]);
How can I get the twig object back out of the container? I tried $container->twig, but I'm not able to get the object back.