39 lines
936B

  1. #!/usr/bin/env php
  2. <?php
  3. /**
  4. * Yii console bootstrap file.
  5. *
  6. * @link http://www.yiiframework.com/
  7. * @copyright Copyright (c) 2008 Yii Software LLC
  8. * @license http://www.yiiframework.com/license/
  9. */
  10. defined('YII_DEBUG') or define('YII_DEBUG', true);
  11. $composerAutoload = [
  12. __DIR__ . '/../vendor/autoload.php', // in yii2-dev repo
  13. __DIR__ . '/../../autoload.php', // installed as a composer binary
  14. ];
  15. $vendorPath = null;
  16. foreach ($composerAutoload as $autoload) {
  17. if (file_exists($autoload)) {
  18. require($autoload);
  19. $vendorPath = dirname($autoload);
  20. break;
  21. }
  22. }
  23. require(__DIR__ . '/Yii.php');
  24. $application = new yii\console\Application([
  25. 'id' => 'yii-console',
  26. 'basePath' => __DIR__ . '/console',
  27. 'controllerNamespace' => 'yii\console\controllers',
  28. ]);
  29. if ($vendorPath !== null) {
  30. $application->setVendorPath($vendorPath);
  31. }
  32. $exitCode = $application->run();
  33. exit($exitCode);