collection-crud/public/index.php

31 lines
852 B
PHP
Raw Normal View History

2020-06-02 16:08:08 -04:00
<?php declare(strict_types=1);
2017-11-30 15:06:13 -05:00
use App\Kernel;
2017-11-30 15:06:13 -05:00
use Symfony\Component\Dotenv\Dotenv;
2020-06-02 16:08:08 -04:00
use Symfony\Component\ErrorHandler\Debug;
2017-11-30 15:06:13 -05:00
use Symfony\Component\HttpFoundation\Request;
2020-06-02 16:08:08 -04:00
require dirname(__DIR__).'/vendor/autoload.php';
2020-06-02 16:08:08 -04:00
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
2020-06-02 16:08:08 -04:00
if ($_SERVER['APP_DEBUG']) {
umask(0000);
2017-11-30 15:06:13 -05:00
Debug::enable();
2017-11-30 15:06:13 -05:00
}
2020-06-02 16:08:08 -04:00
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
2017-11-30 15:06:13 -05:00
2020-06-02 16:08:08 -04:00
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
2017-11-30 15:06:13 -05:00
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);