Core/bin/find-autoloader.php

25 lines
605 B
PHP
Raw Normal View History

<?php
2024-04-14 13:48:14 +00:00
declare(strict_types=1);
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");
}
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';
return;
}
}
2024-04-14 13:48:14 +00:00
detectAndLoadVendor($path . '/../');
}
detectAndLoadVendor();