mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-20 04:23:26 +02:00
feature: router aliases
This commit is contained in:
@@ -116,6 +116,14 @@ $dispatcher = FastRoute\cachedDispatcher(function (FastRoute\RouteCollector $r)
|
||||
$route[0] = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'];
|
||||
}
|
||||
|
||||
$aliases = [
|
||||
[':int', ':string', ':alphanum'],
|
||||
[':\d+', ':[A-Za-z0-9-_%+\']+}', ':[A-Za-z0-9]+'],
|
||||
];
|
||||
|
||||
// apply aliases
|
||||
$route[1] = str_replace($aliases[0], $aliases[1], $route[1]);
|
||||
|
||||
$r->addRoute($route[0], $route[1], $route[2]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user