magnetico-web/public/index.php

31 lines
899 B
PHP
Raw Normal View History

2018-06-20 16:35:08 +00:00
<?php
declare(strict_types=1);
2018-06-20 16:35:08 +00:00
use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
2018-06-20 16:35:08 +00:00
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
2018-06-20 16:35:08 +00:00
if ($_SERVER['APP_DEBUG']) {
2018-06-20 16:35:08 +00:00
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
2018-06-20 16:35:08 +00:00
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
2018-06-20 16:35:08 +00:00
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
2018-06-20 16:35:08 +00:00
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);