Files
breadcrumb-the-shire/config/router.php

20 lines
588 B
PHP
Raw Normal View History

2026-02-04 23:31:53 +01:00
<?php
use MintyPHP\Router;
$routesFile = __DIR__ . '/routes.php';
$routeDefinitions = defined('APP_ROUTE_DEFINITIONS') ? APP_ROUTE_DEFINITIONS : [];
if (!is_array($routeDefinitions) || !$routeDefinitions) {
$routeDefinitions = is_file($routesFile) ? include $routesFile : [];
}
2026-02-04 23:31:53 +01:00
if (is_array($routeDefinitions)) {
foreach ($routeDefinitions as $route) {
$path = trim((string) ($route['path'] ?? ''));
$target = trim((string) ($route['target'] ?? ''));
if ($path !== '' && $target !== '') {
Router::addRoute($path, $target);
}
}
}