5 use Symfony\Bundle\FrameworkBundle\Console\Application
;
6 use Symfony\Component\Console\Input\ArgvInput
;
7 use Symfony\Component\Debug\Debug
;
8 use Symfony\Component\Dotenv\Dotenv
;
12 require __DIR__
.'/../vendor/autoload.php';
14 if (!class_exists(Application
::class)) {
15 throw new \
RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
18 if (!isset($_SERVER['APP_ENV'])) {
19 if (!class_exists(Dotenv
::class)) {
20 throw new \
RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
22 (new Dotenv())->load(__DIR__
.'/../.env');
25 $input = new ArgvInput();
26 $env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ??
'dev', true);
27 $debug = (bool) ($_SERVER['APP_DEBUG'] ??
('prod' !== $env)) && !$input->hasParameterOption('--no-debug', true);
32 if (class_exists(Debug
::class)) {
37 $kernel = new Kernel($env, $debug);
38 $application = new Application($kernel);
39 $application->run($input);