You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
<?php
|
|
|
|
require_once __DIR__ . '/../vendor/autoload.php';
|
|
require_once __DIR__ . '/../config/config.php';
|
|
|
|
use App\AppCreator;
|
|
use App\Router\Middleware\LoggingMiddleware;
|
|
use App\Router\Request\RequestFactory;
|
|
use Shared\ArgumentControllerResolver;
|
|
use Shared\IArgumentResolver;
|
|
use Twig\Environment;
|
|
use Twig\Loader\FilesystemLoader;
|
|
use Shared\Log;
|
|
|
|
$appFactory = new AppCreator();
|
|
$appFactory->registerService(IArgumentResolver::class, ArgumentControllerResolver::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->mapControllers();
|
|
$app->run(RequestFactory::createFromGlobals());
|
|
}
|
|
|