collection-crud/public/index.php

33 lines
872 B
PHP
Raw Normal View History

2022-03-03 10:53:48 -05: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;
2022-03-03 10:53:48 -05:00
require dirname(__DIR__) . '/vendor/autoload.php';
2022-03-03 10:53:48 -05:00
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
2020-06-02 16:08:08 -04:00
if ($_SERVER['APP_DEBUG']) {
2022-03-03 10:53:48 -05:00
umask(0000);
2017-11-30 15:06:13 -05:00
2022-03-03 10:53:48 -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) {
2022-03-03 10:53:48 -05:00
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
2020-06-02 16:08:08 -04:00
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
2022-03-03 10:53:48 -05:00
Request::setTrustedHosts([$trustedHosts]);
2020-06-02 16:08:08 -04:00
}
2017-11-30 15:06:13 -05:00
2022-03-03 10:53:48 -05:00
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
2017-11-30 15:06:13 -05:00
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);