ORM/bin/find-autoloader.php

20 lines
518 B
PHP
Raw Normal View History

<?php
2019-09-04 13:53:44 +00:00
function detectAndLoadVendor($path = __DIR__)
{
$path = realpath($path);
2019-09-04 13:53:44 +00:00
if ('/' == $path) {
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';
return;
}
}
2019-09-04 13:53:44 +00:00
detectAndLoadVendor($path.'/../');
}
2019-09-04 13:53:44 +00:00
detectAndLoadVendor();