public/index.php line 36

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. use App\Kernel;
  11. use Symfony\Component\ErrorHandler\Debug;
  12. use Symfony\Component\Dotenv\Dotenv;
  13. use Symfony\Component\HttpFoundation\Request;
  14. require __DIR__.'/../vendor/autoload.php';
  15. // The check is to ensure we don't use .env in production.
  16. // loadEnv() also loads .env.local (git-ignored), where the real secrets live;
  17. // .env itself only holds placeholders.
  18. if (!isset($_SERVER['APP_ENV'])) {
  19. (new Dotenv())->loadEnv(__DIR__.'/../.env');
  20. }
  21. if ($_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev'))) {
  22. umask(0000);
  23. Debug::enable();
  24. }
  25. Request::setTrustedProxies(['0.0.0.0/0'], Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
  26. $kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev')));
  27. $request = Request::createFromGlobals();
  28. $response = $kernel->handle($request);
  29. $response->send();
  30. $kernel->terminate($request, $response);