bootstrap.php 963 B

123456789101112131415161718192021
  1. <?php
  2. use Symfony\Component\Dotenv\Dotenv;
  3. require dirname(__DIR__).'/vendor/autoload.php';
  4. // Load cached env vars if the .env.local.php file exists
  5. // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
  6. if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
  7. $_SERVER += $env;
  8. $_ENV += $env;
  9. } elseif (!class_exists(Dotenv::class)) {
  10. throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
  11. } else {
  12. // load all the .env files
  13. (new Dotenv())->loadEnv(dirname(__DIR__).'/.env');
  14. }
  15. $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
  16. $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
  17. $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';