FastRoute
FastRoute copied to clipboard
get route list
Hi How to get all the routes defined?
I don't think you can. The routes passed to RouteCollector::addRoute() are immediately parsed and passed to the dataGenerator inside:
public function addRoute($httpMethod, $route, $handler)
{
$route = $this->currentGroupPrefix . $route;
$routeDatas = $this->routeParser->parse($route);
foreach ((array) $httpMethod as $method) {
foreach ($routeDatas as $routeData) {
$this->dataGenerator->addRoute($method, $routeData, $handler);
}
}
}
Perhaps if you extend RouteCollector and overwrite addRoute() you can collect the passed routes