Skip to content

Commit a2c0d05

Browse files
dnnaandig
authored andcommitted
Make vendor dir customizable (#122)
1 parent 23ab519 commit a2c0d05

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Bootstraps/Symfony.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getApplication()
4646
if (file_exists($appAutoLoader)) {
4747
require $appAutoLoader;
4848
} else {
49-
require './vendor/autoload.php';
49+
require $this->getVendorDir().'/autoload.php';
5050
}
5151

5252
// environment loading as of Symfony 3.3
@@ -90,6 +90,20 @@ public function getApplication()
9090

9191
return $app;
9292
}
93+
94+
/**
95+
* Returns the vendor directory containing autoload.php
96+
*
97+
* @return string
98+
*/
99+
protected function getVendorDir()
100+
{
101+
if (getenv('COMPOSER_VENDOR_DIR') && file_exists(getenv('COMPOSER_VENDOR_DIR'))) {
102+
return getenv('COMPOSER_VENDOR_DIR');
103+
} else {
104+
return './vendor';
105+
}
106+
}
93107

94108
/**
95109
* Does some necessary preparation before each request.

0 commit comments

Comments
 (0)