version 0.8.0
This commit is contained in:
parent
f22007003a
commit
e5ca9ef194
95 changed files with 5601 additions and 4042 deletions
46
app/Core/Kernel.php
Normal file
46
app/Core/Kernel.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Anwendungs-Kernel: registriert den Autoloader, lädt Helfer/Config,
|
||||
* startet die Session und übergibt an den Router.
|
||||
*
|
||||
* Bewusst KEIN Composer nötig – ein schlanker Klassen-Autoloader, der die
|
||||
* Standard-Verzeichnisse nach <ClassName>.php durchsucht (Dateiname == Klassenname).
|
||||
*/
|
||||
final class Kernel
|
||||
{
|
||||
public static function boot(string $basePath): void
|
||||
{
|
||||
define('BSB_BASE', $basePath);
|
||||
define('BSB_UPLOADS', $basePath . '/public/uploads');
|
||||
|
||||
spl_autoload_register(static function (string $class) use ($basePath): void {
|
||||
static $dirs = [
|
||||
'app/Core',
|
||||
'app/Database',
|
||||
'app/Services',
|
||||
'app/Controllers/Pages',
|
||||
'app/Controllers/Api',
|
||||
];
|
||||
foreach ($dirs as $dir) {
|
||||
$file = $basePath . '/' . $dir . '/' . $class . '.php';
|
||||
if (is_file($file)) {
|
||||
require $file;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
require $basePath . '/app/Support/helpers.php';
|
||||
require $basePath . '/app/Database/migrations.php'; // globale Migrations-Definitionen
|
||||
|
||||
Config::load($basePath . '/config/config.php');
|
||||
session_start();
|
||||
|
||||
(new Router(
|
||||
require $basePath . '/app/routes/web.php',
|
||||
require $basePath . '/app/routes/api.php'
|
||||
))->dispatch();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue