Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

console 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env php
  2. <?php
  3. use App\Kernel;
  4. use Symfony\Bundle\FrameworkBundle\Console\Application;
  5. use Symfony\Component\Console\Input\ArgvInput;
  6. use Symfony\Component\Debug\Debug;
  7. use Symfony\Component\Dotenv\Dotenv;
  8. set_time_limit(0);
  9. require __DIR__.'/../vendor/autoload.php';
  10. if (!class_exists(Application::class)) {
  11. throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
  12. }
  13. if (!isset($_SERVER['APP_ENV'])) {
  14. if (!class_exists(Dotenv::class)) {
  15. 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.');
  16. }
  17. (new Dotenv())->load(__DIR__.'/../.env');
  18. }
  19. $input = new ArgvInput();
  20. $env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev', true);
  21. $debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption('--no-debug', true);
  22. if ($debug) {
  23. umask(0000);
  24. if (class_exists(Debug::class)) {
  25. Debug::enable();
  26. }
  27. }
  28. $kernel = new Kernel($env, $debug);
  29. $application = new Application($kernel);
  30. $application->run($input);