-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoload.php
More file actions
61 lines (50 loc) · 2.88 KB
/
autoload.php
File metadata and controls
61 lines (50 loc) · 2.88 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/*
*
* █████╗ ███████╗████████╗██╗ ██╗███████╗██████╗ ██████╗ ██╗ ██╗██████╗
* ██╔══██╗██╔════╝╚══██╔══╝██║ ██║██╔════╝██╔══██╗ ██╔══██╗██║ ██║██╔══██╗
* ███████║█████╗ ██║ ███████║█████╗ ██████╔╝ █████╗ ██████╔╝███████║██████╔╝
* ██╔══██║██╔══╝ ██║ ██╔══██║██╔══╝ ██╔══██╗ ╚════╝ ██╔═══╝ ██╔══██║██╔═══╝
* ██║ ██║███████╗ ██║ ██║ ██║███████╗██║ ██║ ██║ ██║ ██║██║
* ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝
*
* The divine lightweight PHP framework
* < 1 Mo • Zero dependencies • Pure PHP 8.3+
*
* Built from scratch. No bloat. POO Embedded.
*
* @author: dawnl3ss (Alex') ©2025 — All rights reserved
* Source available • Commercial license required for redistribution
* → github.com/dawnl3ss/Aether-PHP
*
*/
declare(strict_types=1);
spl_autoload_register(function ($class){
# - Aether Core
if (str_starts_with($class, 'Aether\\')){
# - Aether Modules
if (str_starts_with($class, 'Aether\\Modules\\')){
if (preg_match('/^Aether\\\\Modules\\\\([^\\\\]+)\\\\(.+)$/', $class, $matches)){
$file = __DIR__ . '/src/Aether/Modules/' . $matches[1] . '/src/' . str_replace('\\', '/', $matches[2]) . '.php';
if (file_exists($file)) return require_once $file;
}
}
$file = __DIR__ . '/src/' . str_replace('\\', '/', $class) . '.php';
if (file_exists($file)) return require_once $file;
}
# - Custom App Backend
if (str_starts_with($class, 'App\\')) {
$file = __DIR__ . '/app/' . str_replace('\\', '/', $class) . '.php';
if (file_exists($file)) return require_once $file;
}
# - Testing folder
if (str_starts_with($class, 'testing\\')) {
$file = __DIR__ . '/' . str_replace('\\', '/', $class) . '.php';
if (file_exists($file)) return require_once $file;
}
# - Scripts folder
if (str_starts_with($class, 'bin\\')) {
$file = __DIR__ . '/' . str_replace('\\', '/', $class) . '.php';
if (file_exists($file)) return require_once $file;
}
});