portfolio/public/index.php
2022-06-21 12:33:35 +02:00

35 lines
729 B
PHP
Executable file

<?php
use App\App;
use App\Util\ContainerBuilder;
use App\Utils\DotEnv;
use Slim\Factory\AppFactory;
use Slim\Views\Twig;
use Slim\Views\TwigMiddleware;
use DI\Container;
use function App\addRoutes;
require '../vendor/autoload.php';
error_reporting(E_ALL);
ini_set('display_errors', 1);
date_default_timezone_set('Europe/Paris');
App::setBasePath(dirname(__DIR__));
$container = ContainerBuilder::direct();
$app = AppFactory::createFromContainer($container);
$app->addRoutingMiddleware();
$errorMiddleware = $app->addErrorMiddleware(true, true, true);
$twig = Twig::create('../templates', ['cache' => false]);
$app->add(TwigMiddleware::create($app, $twig));
require '../src/routes.php';
addRoutes($app);
$app->run();