Core/bin/find-autoloader.php

23 lines
575 B
PHP
Raw Normal View History

<?php
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
require_once VENDOR_PATH.'/autoload.php';
return;
}
}
detectAndLoadVendor($path.'/../');
}
detectAndLoadVendor();