}
if ($methodNotAllowed === true) {
$message = sprintf('Route "%s" or method "%s" not allowed.', $this->request->getUrl()->getPath(), $this->request->getMethod());
$this->handleException(new NotFoundHttpException($message, 403));
}
if (count($this->request->getLoadedRoutes()) === 0) {
$rewriteUrl = $this->request->getRewriteUrl();
if ($rewriteUrl !== null) {
$message = sprintf('Route not found: "%s" (rewrite from: "%s")', $rewriteUrl, $this->request->getUrl()->getPath());
} else {
$message = sprintf('Route not found: "%s"', $this->request->getUrl()->getPath());
}
$this->debug($message);
return $this->handleException(new NotFoundHttpException($message, 404));
}
return null;
}
/**
* Handle route-rewrite
*
* @param string $key
* @param string $url
* @return string|null
* @throws HttpException
* @throws Exception
*/
protected function handleRouteRewrite(string $key, string $url): ?string
{
/* If the request has changed */
if ($this->request->hasPendingRewrite() === false) {
return null;
}
"Route not found: "/sitemap.xml/""
*/
public function start(): ?string
{
$this->debug('Router starting');
$this->fireEvents(EventHandler::EVENT_INIT);
$this->loadRoutes();
if ($this->csrfVerifier !== null) {
$this->fireEvents(EventHandler::EVENT_RENDER_CSRF, [
'csrfVerifier' => $this->csrfVerifier,
]);
/* Verify csrf token for request */
$this->csrfVerifier->handle($this->request);
}
$output = $this->routeRequest();
$this->fireEvents(EventHandler::EVENT_LOAD, [
'loadedRoutes' => $this->getRequest()->getLoadedRoutes(),
]);
$this->debug('Routing complete');
return $output;
}
/**
* Routes the request
*
* @return string|null
* @throws HttpException
* @throws Exception
*/
public function routeRequest(): ?string
{
$this->debug('Routing request');
* @var Router
*/
protected static $router;
/**
* Start routing
*
* @throws \Pecee\SimpleRouter\Exceptions\NotFoundHttpException
* @throws \Pecee\Http\Middleware\Exceptions\TokenMismatchException
* @throws HttpException
* @throws Exception
*/
public static function start(): void
{
// Set default namespaces
foreach (static::router()->getRoutes() as $route) {
static::addDefaultNamespace($route);
}
echo static::router()->start();
}
/**
* Start the routing an return array with debugging-information
*
* @return array
*/
public static function startDebug(): array
{
$routerOutput = null;
try {
ob_start();
static::router()->setDebugEnabled(true)->start();
$routerOutput = ob_get_clean();
} catch (Exception $e) {
}
// Try to parse library version
use App\Router\Router\SimpleRouter;
require_once __DIR__. '/helpers.php';
class Router extends SimpleRouter {
protected static string $routeFolder = "routes";
public static function loadRoutes(string $basePath)
{
$folderStructure = scandir($basePath . static::$routeFolder);
foreach($folderStructure as $name => $file) {
if(!in_array($file, array('.', '..'))) {
require_once ($basePath . static::$routeFolder . DIRECTORY_SEPARATOR . $file);
}
}
static::start();
}
}
namespace App\Application;
use App\Bootstrap\Bootstrap;
use App\Bootstrap\Handler\HandlerInterface;
use App\Router\Router;
use App\Session\Session;
class Frontend extends Bootstrap
{
public function run()
{
foreach ($this->getHandler() as $name => $handler) {
if(!$handler instanceof HandlerInterface) {
throw new \Exception("Invalid instance for {$name}");
}
$handler->handle();
}
Router::loadRoutes(APPLICATION_PATH);
}
}
<?php
use App\Application\Frontend;
use App\Bootstrap\Handler\ErrorHandler;
use App\Bootstrap\Handler\SessionHandler;
define('APPLICATION_START', microtime(true));
define('APPLICATION_PATH', dirname(__FILE__, 2) . DIRECTORY_SEPARATOR);
require_once (APPLICATION_PATH . 'vendor/autoload.php');
$app = new Frontend();
$app->pushHandler('session', new SessionHandler());
$app->pushHandler('error', new ErrorHandler());
$app->run();
Key | Value |
frawork__last_regenerate | 1755896622
|
Key | Value |
REDIRECT_STATUS | "200"
|
UNIQUE_ID | "aKjbLbURvWEvSrkfJRdnDAAAAew"
|
SCRIPT_URL | "/sitemap.xml"
|
SCRIPT_URI | "https://cc-magdeburg.de/sitemap.xml"
|
HTTPS | "on"
|
DOCUMENT_ROOT | "/home/strato/http/power/rid/58/06/511565806/htdocs/cc-magdeburg.de/public/"
|
RZ_php | "80"
|
PHPRC | "/home/strato/http/power/rid/58/06/511565806/htdocs/cc-magdeburg.de/public/"
|
HTTP_HOST | "cc-magdeburg.de"
|
HTTP_ACCEPT | "*/*"
|
HTTP_USER_AGENT | "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)"
|
HTTP_ACCEPT_ENCODING | "gzip, br, zstd, deflate"
|
HTTP_CONNECTION | "close"
|
PATH | "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
|
SERVER_SOFTWARE | "Apache/2.4.65 (Unix)"
|
SERVER_NAME | "cc-magdeburg.de"
|
SERVER_PORT | "443"
|
REMOTE_ADDR | "216.73.216.181"
|
SERVER_ADMIN | "service@webmailer.de"
|
SCRIPT_FILENAME | "/home/strato/http/power/rid/58/06/511565806/htdocs/cc-magdeburg.de/public/index.php"
|
REMOTE_PORT | "53383"
|
REDIRECT_URL | "/sitemap.xml"
|
GATEWAY_INTERFACE | "CGI/1.1"
|
SERVER_PROTOCOL | "HTTP/1.1"
|
REQUEST_METHOD | "GET"
|
QUERY_STRING | "" |
REQUEST_URI | "/sitemap.xml"
|
SCRIPT_NAME | "/index.php"
|
ORIG_PATH_INFO | "/sitemap.xml"
|
ORIG_PATH_TRANSLATED | "/home/strato/http/power/rid/58/06/511565806/htdocs/cc-magdeburg.de/public/index.php"
|
PHP_SELF | "/index.php"
|
REQUEST_TIME_FLOAT | 1755896621.9475
|
REQUEST_TIME | 1755896621
|
argv | [] |
argc | 0
|
Key | Value |
REDIRECT_STATUS | "200"
|
UNIQUE_ID | "aKjbLbURvWEvSrkfJRdnDAAAAew"
|
SCRIPT_URL | "/sitemap.xml"
|
SCRIPT_URI | "https://cc-magdeburg.de/sitemap.xml"
|
HTTPS | "on"
|
DOCUMENT_ROOT | "/home/strato/http/power/rid/58/06/511565806/htdocs/cc-magdeburg.de/public/"
|
RZ_php | "80"
|
PHPRC | "/home/strato/http/power/rid/58/06/511565806/htdocs/cc-magdeburg.de/public/"
|
HTTP_HOST | "cc-magdeburg.de"
|
HTTP_ACCEPT | "*/*"
|
HTTP_USER_AGENT | "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)"
|
HTTP_ACCEPT_ENCODING | "gzip, br, zstd, deflate"
|
HTTP_CONNECTION | "close"
|
PATH | "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
|
SERVER_SOFTWARE | "Apache/2.4.65 (Unix)"
|
SERVER_NAME | "cc-magdeburg.de"
|
SERVER_PORT | "443"
|
REMOTE_ADDR | "216.73.216.181"
|
SERVER_ADMIN | "service@webmailer.de"
|
SCRIPT_FILENAME | "/home/strato/http/power/rid/58/06/511565806/htdocs/cc-magdeburg.de/public/index.php"
|
REMOTE_PORT | "53383"
|
REDIRECT_URL | "/sitemap.xml"
|
GATEWAY_INTERFACE | "CGI/1.1"
|
SERVER_PROTOCOL | "HTTP/1.1"
|
REQUEST_METHOD | "GET"
|
QUERY_STRING | "" |
REQUEST_URI | "/sitemap.xml"
|
SCRIPT_NAME | "/index.php"
|
ORIG_PATH_INFO | "/sitemap.xml"
|
ORIG_PATH_TRANSLATED | "/home/strato/http/power/rid/58/06/511565806/htdocs/cc-magdeburg.de/public/index.php"
|