collection-crud/public/index.php

34 lines
859 B
PHP
Raw Normal View History

<?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');
2023-07-21 10:35:15 -04:00
if ($_SERVER['APP_DEBUG'])
{
umask(0000);
2017-11-30 15:06:13 -05:00
2023-07-21 10:35:15 -04:00
Debug::enable();
2017-11-30 15:06:13 -05:00
}
2023-07-21 10:35:15 -04:00
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? FALSE)
{
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
2020-06-02 16:08:08 -04:00
}
2023-07-21 10:35:15 -04:00
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? FALSE)
{
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);