-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathautoload.php
More file actions
32 lines (28 loc) · 774 Bytes
/
autoload.php
File metadata and controls
32 lines (28 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* Inits autoload. In case composer autoload is not found, will be able
* to load Konstrui\ classes on its own.
*
* TODO should not try to load classes outside from Konstrui\ namespace.
*/
$autoloadLookupPaths = [
__DIR__ . '/vendor/autoload.php',
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../vendor/autoload.php',
__DIR__ . '/../../../vendor/autoload.php',
];
foreach ($autoloadLookupPaths as $path) {
if (file_exists($path)) {
require $path;
return;
}
}
spl_autoload_register(function ($className) {
$className = ltrim($className, '\\');
$path = __DIR__ . '/src/' . str_replace(
'\\',
DIRECTORY_SEPARATOR,
$className
) . '.php';
require $path;
});