Skip to content
PHP Ecosystem
Explore

RouterSnapshot

API reference › Debug Core › Panel › Router › RouterSnapshot

final readonly classPHPForge\Debug\Panel\Router\RouterSnapshot
ImplementsPHPForge\Debug\Storage\PanelSnapshot
Sourcesrc/Panel/Router/RouterSnapshot.php

Canonical routing trace snapshot, with the URL-rule trace resolved into typed rows at capture time.

PropertyTypeDescriptionDefined by
$action readonly constructorstring|nullDispatched action descriptor, or null when routing resolved none.RouterSnapshot
$message readonly constructorstring|nullRouting trace message emitted by the URL manager, or null when it emitted none.RouterSnapshot
$route readonly constructorstringRoute the request resolved to.RouterSnapshot
MethodDescriptionDefined by
__construct()Creates a routing snapshot from the captured rule trace.RouterSnapshot
capture() staticReplays the URL-manager trace into typed rows, dropping the duplicate emitted by nested REST rules.RouterSnapshot
entries()Returns the URL rules inspected while resolving the route.RouterSnapshot
fromArray() staticNarrows the persisted routing payload into a typed snapshot.RouterSnapshot
hasMatch()Returns whether any inspected rule reported a successful match.RouterSnapshot
jsonSerialize()Returns the panel snapshot for JSON serialization.RouterSnapshot
public function __construct(string|null $action, string $route, string|null $message, list<PHPForge\Debug\Panel\Router\CurrentRouteLogRow> $entries)

Creates a routing snapshot from the captured rule trace.

Parameters

ParameterTypeDescription
$actionstring|null
$routestring
$messagestring|null
$entrieslist<CurrentRouteLogRow>
public static function capture(string|null $action, array<int, array<int|string, mixed>> $messages, string $route): self

Replays the URL-manager trace into typed rows, dropping the duplicate emitted by nested REST rules.

Parameters

ParameterTypeDescription
$actionstring|null
$messagesarray<int, array<int|string, mixed>>Raw routing log tuples in capture order.
$routestring

Returns

self

public function entries(): list<PHPForge\Debug\Panel\Router\CurrentRouteLogRow>

Returns the URL rules inspected while resolving the route.

Returns

list<CurrentRouteLogRow>: Rules inspected during routing, in inspection order.

public static function fromArray(mixed $data, string $path): self

Narrows the persisted routing payload into a typed snapshot.

Parameters

ParameterTypeDescription
$datamixedPersisted payload, expected to be an object carrying the declared shape.
$pathstringJSON path of the payload, used to report a malformed capture.

Returns

self: Snapshot carrying the resolved route and the inspected rules.

public function hasMatch(): bool

Returns whether any inspected rule reported a successful match.

Returns

bool

public function jsonSerialize(): array<string, mixed>

Returns the panel snapshot for JSON serialization.

Returns

array<string, mixed>