web/app.php line 96

Open in your IDE?
  1. <?php
  2. use Symfony\Component\HttpFoundation\Request;
  3. use Symfony\Component\Debug\Debug;
  4. // Ensure UTF-8 is used in string operations
  5. setlocale(LC_CTYPE'C.UTF-8');
  6. // Environment is taken from "SYMFONY_ENV" variable, if not set, defaults to "prod"
  7. $environment getenv('SYMFONY_ENV');
  8. if ($environment === false) {
  9.     $environment 'prod';
  10. }
  11. // Depending on the SYMFONY_DEBUG environment variable, tells whether Symfony should be loaded with debugging.
  12. // If not set, or "", it is auto activated if in "dev" environment.
  13. if (($useDebugging getenv('SYMFONY_DEBUG')) === false || $useDebugging === '') {
  14.     $useDebugging $environment === 'dev';
  15. }
  16. // Depending on SYMFONY_CLASSLOADER_FILE use custom class loader, otherwise use bootstrap cache, or autoload in debug
  17. if ($loaderFile getenv('SYMFONY_CLASSLOADER_FILE')) {
  18.     require_once $loaderFile;
  19. } else {
  20.     require_once __DIR__ '/../vendor/autoload.php';
  21.     if (!$useDebugging) {
  22.         require_once __DIR__ '/../var/bootstrap.php.cache';
  23.     }
  24. }
  25. require_once __DIR__ '/../app/AppKernel.php';
  26. if ($useDebugging) {
  27.     Debug::enable();
  28. }
  29. $kernel = new AppKernel($environment$useDebugging);
  30. // we don't want to use the classes cache if we are in a debug session
  31. if (!$useDebugging) {
  32.     $kernel->loadClassCache();
  33. }
  34. // Depending on the SYMFONY_HTTP_CACHE environment variable, tells whether the internal HTTP Cache mechanism is to be used.
  35. // If not set, or "", it is auto activated if _not_ in "dev" environment.
  36. if (($useHttpCache getenv('SYMFONY_HTTP_CACHE')) === false || $useHttpCache === '') {
  37.     $useHttpCache $environment !== 'dev';
  38. }
  39. // Load HTTP Cache ...
  40. if ($useHttpCache) {
  41.     // The standard HttpCache implementation can be overridden by setting the SYMFONY_HTTP_CACHE_CLASS environment variable.
  42.     // NOTE: Make sure to setup composer config so it is *autoloadable*, or use "SYMFONY_CLASSLOADER_FILE" for this.
  43.     if ($httpCacheClass getenv('SYMFONY_HTTP_CACHE_CLASS')) {
  44.         $kernel = new $httpCacheClass($kernel);
  45.     } else {
  46.         require_once __DIR__ '/../app/AppCache.php';
  47.         $kernel = new AppCache($kernel);
  48.     }
  49. }
  50. $request Request::createFromGlobals();
  51. // If you are behind one or more trusted reverse proxies, you might want to set them in SYMFONY_TRUSTED_PROXIES environment
  52. // variable in order to get correct client IP
  53. if ($trustedProxies getenv('SYMFONY_TRUSTED_PROXIES')) {
  54.     Request::setTrustedProxies(explode(','$trustedProxies), Request::HEADER_X_FORWARDED_ALL);
  55. }
  56. function dump() {
  57.     $dev = isset($_GET['dev']) ? filter_var($_GET['dev'], FILTER_VALIDATE_BOOLEAN) : false;
  58.     // If $dev is true, then perform the var_dump on all provided parameters
  59.     if ($dev) {
  60.         $numArgs func_num_args();
  61.         if ($numArgs 0) {
  62.             for ($i 0$i $numArgs$i++) {
  63.                 $arg func_get_arg($i);
  64.                 var_dump($arg);
  65.             }
  66.         }
  67.     }
  68.     return $dev;
  69. }
  70. function dd() {
  71.     $dumped dump(...func_get_args());
  72.     if ($dumped) {
  73.         die();
  74.     }
  75. }
  76. $response $kernel->handle($request);
  77. $response->send();
  78. $kernel->terminate($request$response);