#!/usr/bin/env php dirname(__DIR__) . '/../../../', dirname(__DIR__) . '/vendor/autoload.php' => dirname(__DIR__) ]; $autoloaderPath = null; $pojectDir = null; foreach ($candidates as $autoloaderPathCandidate => $projectDirCandidate) { if (file_exists($autoloaderPathCandidate) && file_exists($projectDirCandidate . '/.env')) { $autoloaderPath = $autoloaderPathCandidate; $projectDir = $projectDirCandidate; break; } } if (null === $autoloaderPath) { throw new RuntimeException('Unable to locate autoload.php file.'); } if (null === $projectDir) { throw new RuntimeException('Unable to locate symfony project dir with .env file.'); } require_once $autoloaderPath; unset($candidates, $autoloaderPathCandidate, $projectDirCandidate); if (!class_exists(Application::class) || !class_exists(Dotenv::class)) { throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.'); } $input = new ArgvInput(); if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) { putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); } if ($input->hasParameterOption('--no-debug', true)) { putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); } if (file_exists($projectDir . '/.env')) { (new Dotenv())->bootEnv($projectDir . '/.env'); } $debug = false; if (isset($_SERVER['APP_DEBUG']) && $_SERVER['APP_DEBUG']) { $debug = true; umask(0000); if (class_exists(Debug::class)) { Debug::enable(); } } $kernel = new StandaloneKernel($_SERVER['APP_ENV'], $debug); $application = new Application($kernel); $application->run($input);