getConfig(); $basePath = app_normalize_base_path((string) ($config['app']['base_path'] ?? '')); } return $basePath; } function app_url(string $path = '/'): string { $basePath = app_base_path(); $normalizedPath = '/' . ltrim($path, '/'); if ($normalizedPath === '/') { return $basePath === '' ? '/' : $basePath . '/'; } return $basePath . $normalizedPath; } function app_read_json_body(): array { $raw = file_get_contents('php://input'); if ($raw === false || trim($raw) === '') { return []; } $decoded = json_decode($raw, true); if (!is_array($decoded)) { throw new RuntimeException('Ungültiger JSON-Body.'); } return $decoded; }