silverstripe-framework/src/includes/autoload.php
2017-10-03 09:03:37 +13:00

21 lines
570 B
PHP

<?php
// Init composer autoload
call_user_func(function () {
$candidates = [
// module in vendor
__DIR__ . '/../../../../autoload.php',
// module itself is webroot (usually during CI installs)
__DIR__ . '/../../vendor/autoload.php',
// fallback
getcwd() . '/vendor/autoload.php',
];
foreach ($candidates as $candidate) {
if (file_exists($candidate)) {
require_once $candidate;
return;
}
}
die("Failed to include composer's autoloader, unable to continue");
});