This repository has been archived on 2026-03-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blog-slim.old/public/index.php
2026-03-09 12:34:39 +01:00

34 lines
733 B
PHP

<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
use Slim\Factory\AppFactory;
use Slim\Views\TwigMiddleware;
// Charger et créer les services centralisés
$services = App\Factories\ServiceFactory::createServices();
/** @var \Slim\Views\Twig $twig */
$twig = $services['view'];
// Slim app
$app = AppFactory::create();
// Middlewares essentiels
$app->addBodyParsingMiddleware();
$app->add(TwigMiddleware::create($app, $twig));
// Charger les routes
$routesPath = __DIR__ . '/../src/Routes/web.php';
if (file_exists($routesPath)) {
/** @var callable $routes */
$routes = require $routesPath;
$routes($app);
}
$errorMiddleware = $app->addErrorMiddleware(true, true, true);
$app->run();