2019-08-30 13:48:13 +00:00
|
|
|
<?php
|
2019-09-04 13:53:44 +00:00
|
|
|
|
|
|
|
|
function detectAndLoadVendor($path = __DIR__)
|
|
|
|
|
{
|
2019-08-30 13:48:13 +00:00
|
|
|
$path = realpath($path);
|
2019-09-04 13:53:44 +00:00
|
|
|
if ('/' == $path) {
|
2019-08-30 13:48:13 +00:00
|
|
|
die("Could not find a suitable /vendor directory! Maybe you need to run composer install!\n");
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-04 13:53:44 +00:00
|
|
|
foreach (new DirectoryIterator($path) as $fileInfo) {
|
|
|
|
|
if ($fileInfo->isDir() && 'vendor' == $fileInfo->getFilename()) {
|
|
|
|
|
require_once $fileInfo->getRealPath().'/autoload.php';
|
|
|
|
|
|
2019-08-30 13:48:13 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-04 13:53:44 +00:00
|
|
|
detectAndLoadVendor($path.'/../');
|
2019-08-30 13:48:13 +00:00
|
|
|
}
|
2019-09-04 13:53:44 +00:00
|
|
|
detectAndLoadVendor();
|