2020-11-22 07:38:44 +00:00
|
|
|
<?php
|
|
|
|
|
2024-04-14 13:48:14 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-11-22 07:38:44 +00:00
|
|
|
function detectAndLoadVendor($path = __DIR__): void
|
|
|
|
{
|
|
|
|
$path = realpath($path);
|
|
|
|
if ('/' == $path) {
|
2021-01-22 04:20:21 +00:00
|
|
|
exit("Could not find a suitable /vendor directory! Maybe you need to run composer install!\n");
|
2020-11-22 07:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach (new DirectoryIterator($path) as $fileInfo) {
|
|
|
|
if ($fileInfo->isDir() && 'vendor' == $fileInfo->getFilename()) {
|
|
|
|
define('VENDOR_PATH', $fileInfo->getRealPath());
|
2021-01-22 04:20:21 +00:00
|
|
|
|
2024-04-14 13:48:14 +00:00
|
|
|
require_once VENDOR_PATH . '/autoload.php';
|
2020-11-22 07:38:44 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2024-04-14 13:48:14 +00:00
|
|
|
detectAndLoadVendor($path . '/../');
|
2020-11-22 07:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
detectAndLoadVendor();
|