registerService(IArgumentResolver::class, ArgumentControllerResolver::class); $appFactory->registerService(UserManager::class, UserManager::class); $appFactory->registerService(DataManager::class, StubData::class); $appFactory->registerService(IAuthService::class, AuthService::class); $appFactory->registerService(IFriendRequestService::class, RelationshipService::class); $appFactory->registerService(IHashPassword::class, HashPassword::class); $appFactory->registerService(INotificationService::class, NotificationService::class); $appFactory->registerService(INotificationRepository::class, NotificationRepository::class); $appFactory->registerService(IUserRepository::class, UserRepository::class); $appFactory->registerService(\Twig\Loader\LoaderInterface::class, function() { return new FilesystemLoader(__DIR__ . '/../src/app/views/Templates'); }); $appFactory->registerService(\Twig\Environment::class,\Twig\Environment::class); // Connexion à la base de données // $databaseContext = DatabaseContext::getInstance(); $appFactory->AddControllers(); $app = $appFactory->create(); if (!is_null($app)){ // Ajout des Middleware /*$app->use(new LoggingMiddleware());*/ $app->use(new AuthMiddleware()); $app->mapControllers(); $app->run(RequestFactory::createFromGlobals()); }