From e3e41fa157ec087de6565a087583b26f3690c652 Mon Sep 17 00:00:00 2001 From: Dimosthenis Nikoudis Date: Fri, 3 Aug 2018 19:36:20 +0300 Subject: [PATCH 1/2] Make vendor dir customizable --- Bootstraps/Symfony.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Bootstraps/Symfony.php b/Bootstraps/Symfony.php index 09b49e2..0afabfd 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. From d938dbfa229c2a225ca9c4548f52bebfd4b6fec5 Mon Sep 17 00:00:00 2001 From: Dimosthenis Nikoudis Date: Fri, 3 Aug 2018 19:41:45 +0300 Subject: [PATCH 2/2] cs fix --- Bootstraps/Symfony.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bootstraps/Symfony.php b/Bootstraps/Symfony.php index 0afabfd..669f6b9 100644 --- a/Bootstraps/Symfony.php +++ b/Bootstraps/Symfony.php @@ -98,7 +98,7 @@ public function getApplication() */ protected function getVendorDir() { - if(getenv('COMPOSER_VENDOR_DIR') && file_exists(getenv('COMPOSER_VENDOR_DIR'))) { + if (getenv('COMPOSER_VENDOR_DIR') && file_exists(getenv('COMPOSER_VENDOR_DIR'))) { return getenv('COMPOSER_VENDOR_DIR'); } else { return './vendor';