From 5216463275845a527e6eba66612a819b86de452c Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Wed, 22 Nov 2023 14:58:08 -0300 Subject: [PATCH] Fix run any directory, --- bin/queue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/queue b/bin/queue index 792017f3..cd3b9cfa 100644 --- a/bin/queue +++ b/bin/queue @@ -8,7 +8,15 @@ use Symfony\Component\Console\Application; use Yiisoft\Di\Container; use Yiisoft\Di\ContainerConfig; -require_once './vendor/autoload.php'; +$autoload = $GLOBALS['_composer_autoload_path'] ?? './vendor/autoload.php'; + +if (!file_exists($autoload)) { + throw new RuntimeException( + 'Please run "composer install" in your project root to install the required dependencies.' + ); +} + +require_once $autoload; /** @var array $definitions */ $definitions = require_once 'definitions.php';