web/app.php line 81

Open in your IDE?
  1. <?php
  2. use Symfony\Component\HttpFoundation\Request;
  3. use Symfony\Component\Debug\Debug;
  4. require __DIR__.'/../vendor/autoload.php';
  5. // Environment is taken from "ENVIRONMENT" variable, if not set, defaults to "prod"
  6. $environment getenv('SYMFONY_ENV');
  7. if ( $environment === false )
  8. {
  9.     $environment 'prod';
  10. }
  11. // Depending on the USE_DEBUGGING environment variable, tells whether Symfony should be loaded with debugging.
  12. // If not set it is activated if in "dev" environment.
  13. if ( ( $useDebugging getenv('USE_DEBUGGING') ) === false )
  14. {
  15.     $useDebugging $environment === 'dev';
  16. }
  17. // Uncomment below before running behat tests. No, this is not the proper way to do it.
  18. if ( $useDebugging )
  19. {
  20.     $loader = require_once __DIR__ '/../bin/autoload.php';
  21. }
  22. else
  23. {
  24.     $loader = require_once __DIR__ '/../app/bootstrap.php.cache';
  25. }
  26. // Depending on the USE_APC_CLASSLOADER environment variable, use APC for autoloading to improve performance.
  27. // If not set it is not used.
  28. //if ( getenv('USE_APC_CLASSLOADER') )
  29. //{
  30. //    $prefix = getenv('APC_CLASSLOADER_PREFIX');
  31. //
  32. //    $loader = new ApcClassLoader( $prefix ?: 'app', $loader );
  33. //    $loader->register( true );
  34. //}
  35. require_once __DIR__ '/../app/AppKernel.php';
  36. if ( $useDebugging )
  37. {
  38.     Debug::enable();
  39. }
  40. $kernel = new AppKernel$environment$useDebugging );
  41. // we don't want to use the classes cache if we are in a debug session
  42. if ( !$useDebugging )
  43. {
  44.     $kernel->loadClassCache();
  45. }
  46. // Depending on the USE_HTTP_CACHE environment variable, tells whether the internal HTTP Cache mechanism is to be used.
  47. // If not set it is activated if not in "dev" environment.
  48. if ( ( $useHttpCache getenv('USE_HTTP_CACHE') ) === false )
  49. {
  50.     $useHttpCache $environment !== 'dev';
  51. }
  52. // Load HTTP Cache ...
  53. if ( $useHttpCache )
  54. {
  55.     require_once __DIR__ '/../app/AppCache.php';
  56.     $kernel = new AppCache$kernel );
  57. }
  58. $request Request::createFromGlobals();
  59. // If you are behind one or more trusted reverse proxies, you might want to set them in TRUSTED_PROXIES environment
  60. // variable in order to get correct client IP
  61. if ( ( $trustedProxies getenv('TRUSTED_PROXIES') ) !== false )
  62. {
  63.     Request::setTrustedProxiesexplode','$trustedProxies ) );
  64. }
  65. $response $kernel->handle$request );
  66. $response->send();
  67. $kernel->terminate$request$response );