5 use Symfony\Bundle\FrameworkBundle\Console\Application
;
6 use Symfony\Component\Console\Input\ArgvInput
;
7 use Symfony\Component\Debug\Debug
;
9 if (false === in_array(\PHP_SAPI
, ['cli', 'phpdbg', 'embed'], true)) {
10 echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI
.' SAPI'.\PHP_EOL
;
15 require dirname(__DIR__
).'/vendor/autoload.php';
17 if (!class_exists(Application
::class)) {
18 throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
21 $input = new ArgvInput();
22 if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
23 putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
26 if ($input->hasParameterOption('--no-debug', true)) {
27 putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
30 require dirname(__DIR__
).'/config/bootstrap.php';
32 if ($_SERVER['APP_DEBUG']) {
35 if (class_exists(Debug
::class)) {
40 $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
41 $application = new Application($kernel);
42 $application->run($input);