diff --git a/Bootstraps/Symfony.php b/Bootstraps/Symfony.php index 09b49e2..669f6b9 100644 --- a/Bootstraps/Symfony.php +++ b/Bootstraps/Symfony.php @@ -46,7 +46,7 @@ public function getApplication() if (file_exists($appAutoLoader)) { require $appAutoLoader; } else { - require './vendor/autoload.php'; + require $this->getVendorDir().'/autoload.php'; } // environment loading as of Symfony 3.3 @@ -90,6 +90,20 @@ public function getApplication() return $app; } + + /** + * Returns the vendor directory containing autoload.php + * + * @return string + */ + protected function getVendorDir() + { + if (getenv('COMPOSER_VENDOR_DIR') && file_exists(getenv('COMPOSER_VENDOR_DIR'))) { + return getenv('COMPOSER_VENDOR_DIR'); + } else { + return './vendor'; + } + } /** * Does some necessary preparation before each request.