addRoutingMiddleware(); $errorMiddleware = $app->addErrorMiddleware(true, true, true); // we place the definition BEFORE the localization middleware to get the locale attribute $app->add(new TwigLocalizationMiddleware($container)); $app->add($container->get(LocalizationMiddleware::class)); $app->add(TwigMiddleware::create($app, $container->get(Twig::class))); require '../src/routes.php'; addRoutes($app); $app->run();