Skip to content

Router Collector ​

Captures HTTP route matching data — matched route, pattern, arguments, match timing, and the full route tree.

Router Collector panel

What It Captures ​

FieldDescription
currentRoute.nameRoute name (if named)
currentRoute.patternRoute URL pattern
currentRoute.argumentsMatched route parameters
currentRoute.hostHost constraint (if any)
currentRoute.uriActual matched URI
currentRoute.actionController/action handler
currentRoute.middlewaresRoute-level middleware stack
currentRoute.matchTimeTime to match the route (seconds)
routesFull route table
routesTreeRoute tree structure

Data Schema ​

json
{
    "currentRoute": {
        "matchTime": 0.00012,
        "name": "user.show",
        "pattern": "/users/{id}",
        "arguments": {"id": "42"},
        "host": null,
        "uri": "/users/42",
        "action": "App\\Controller\\UserController::show",
        "middlewares": ["auth", "throttle"]
    },
    "routes": [...],
    "routesTree": [...],
    "routeTime": 0.00012
}

Summary (shown in debug entry list):

json
{
    "router": {
        "matchTime": 0.00012,
        "name": "user.show",
        "pattern": "/users/{id}"
    }
}

Contract ​

php
use AppDevPanel\Kernel\Collector\RouterCollector;

$collector->collectMatchedRoute([
    'name' => 'user.show',
    'pattern' => '/users/{id}',
    'arguments' => ['id' => '42'],
    'host' => null,
    'uri' => '/users/42',
    'action' => 'App\\Controller\\UserController::show',
    'middlewares' => ['auth', 'throttle'],
]);
$collector->collectMatchTime(matchTime: 0.00012);
$collector->collectRoutes(routes: $allRoutes, routesTree: $routeTree);

How It Works ​

Each framework adapter has a RouterDataExtractor that normalizes framework-specific route data into the common format:

Debug Panel ​

  • Matched route — current route pattern, name, and matched parameters
  • Route arguments — key-value pairs of resolved parameters
  • Action handler — controller class and method
  • Match timing — how long route matching took

Released under the MIT License.