I'm developing a simple website , with Slim Framework and Twig for engine , only returning error in the browser, this is the content of my file index.php
(in the project root):
require_once './vendor/autoload.php';
// Create container
$container = new \Slim\Container;
// Register component on container
$container['view'] = function ($c) {
$view = new \Slim\Views\Twig('app/views', [
'cache' => 'app/storage/cache'
]);
$view->addExtension(new \Slim\Views\TwigExtension(
$c['router'],
$c['request']->getUri()
));
return $view;
};
// Create app
$app = new \Slim\App($container);
// Routes
$app->get('/', function() use ($app) {
$app->render('index.twig', ['app' => $app]);
})->name('home');
// Run app
$app->run();
My folder structure looks like this:
app
|__views
|__storage
|__cache
vendor
|__twig
|__slim
|__psr
|__composer
assets
|__css
|__js
|__img
|__fonts
I followed the instructions in this example: h ttp: //www.slimframework.com/docs/features/templates. html
I would like to render the view "home", but only returns:
Error 500