rinkplanner/hub/web/index.php

25 lines
641 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
/**
* Rinkplanner-Hub – Front Controller.
* Apache leitet alle nicht vorhandenen Dateien über .htaccess hierher.
*/
require __DIR__ . '/app/bootstrap.php';
$uriPath = (string) parse_url((string) ($_SERVER['REQUEST_URI'] ?? '/'), PHP_URL_PATH);
$basePath = rtrim((string) config('app.base_path', ''), '/');
if ($basePath !== '' && str_starts_with($uriPath, $basePath)) {
$uriPath = substr($uriPath, strlen($basePath));
}
$path = '/' . trim($uriPath, '/');
$method = request_method();
if (str_starts_with($path, '/api/')) {
api_handle($method, $path);
exit;
}
page_handle($method, $path);