This commit is contained in:
torsten 2026-10-23 13:14:31 +02:00
parent 1db373a03d
commit 9bcbd3e194
118 changed files with 1116 additions and 155 deletions

View file

@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
/*
* Bootstrap: lädt .env, Konfiguration, Autoloader, Session und startet die
* Anwendung. Wird sowohl vom Front-Controller als auch von CLI-Skripten
* eingebunden.
*/
define('BASE_PATH', dirname(__DIR__));
// Fehlerbehandlung
error_reporting(E_ALL);
ini_set('display_errors', '1');
// Autoloader für den Namespace App\ (Quellen liegen in src/)
spl_autoload_register(function (string $class): void {
$prefix = 'App\\';
if (!str_starts_with($class, $prefix)) {
return;
}
$relative = substr($class, strlen($prefix));
$file = BASE_PATH . '/src/' . str_replace('\\', '/', $relative) . '.php';
if (is_file($file)) {
require $file;
}
});
require_once BASE_PATH . '/src/helpers.php';
load_env_file(BASE_PATH . '/.env');
/** Startet eine Session (für Web-Requests). */
function start_session(): void
{
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
}