I have a problem with dependency injection container and twig, I use Illuminate/Container
:
// Register templates.
$this->singleton('templates', function ($c) {
$twig = new \Twig_Environment(
new \Twig_Loader_Filesystem([$c['paths.templates']]),
[
'debug' => true,
// 'cache' => $c['paths.cache']
]
);
$twig->addExtension(new \Twig_Extension_Debug());
$twig->addGlobal('app', $c['app']);
return $twig;
});
$c['app']
is the container.
And in my template file I wanna access to my bindings:
{{ app.config.siteName }}
But that didn't work for me, I think it's a problem because the container implements to ArrayAcess