Skip to content
PHP Ecosystem
Explore

RouterCollector

API reference › Debug › collectors › RouterCollector

classyii\debug\collectors\RouterCollector
ExtendsCollector
ImplementsCollectorInterface
Sourcesrc/collectors/RouterCollector.php

Captures the routing trace of the request for the Router panel.

PropertyTypeDescriptionDefined by
$moduleyii\debug\Module|nullDebug module supplying the log target and sibling collectors, assigned by the module on registration. Default: null.Collector
MethodDescriptionDefined by
capture() finalEncodes the typed snapshot built by the subclass into the payload persisted for the panel.Collector
getCategories()Returns the log categories scanned for routing trace messages.RouterCollector
id()Returns the stable ID pairing this collector with the Router panel.RouterCollector
instrument()Installs low-level instrumentation as soon as the module registers the collector, before the panels are built.Collector
setCategories()Appends one or more log categories to $categories.RouterCollector
shutdown() finalDeactivates the collector once, releasing any subscription created by start().Collector
startup() finalActivates the collector once at the start of the request lifecycle.Collector
getLogMessages() protectedReturns the accumulated log messages, optionally filtered by level, category, and exclusion lists.Collector
getLogTarget() protectedReturns the initialized log target of the owning debug module.Collector
isStarted() protectedReturns whether the collector is active for the current request.Collector
snapshot() protectedSnapshots the routing trace, the resolved route, and the dispatched action.RouterCollector
start() protectedHook invoked once when the collector activates; subclasses subscribe to framework events here.Collector
stop() protectedHook invoked once when the collector deactivates; subclasses detach subscriptions and clear state here.Collector
public function getCategories(): list<string>

Returns the log categories scanned for routing trace messages.

Returns

list<string>: Category names in declaration order.

public function id(): string

Returns the stable ID pairing this collector with the Router panel.

Returns

string: Stable collector ID.

public function setCategories(list<string>|string $values): void

Appends one or more log categories to $categories.

Parameters

ParameterTypeDescription
$valueslist<string>|stringSingle category, or list of categories.
protected function snapshot(): PHPForge\Debug\Panel\Router\RouterSnapshot|null

Snapshots the routing trace, the resolved route, and the dispatched action.

Returns

PHPForge\Debug\Panel\Router\RouterSnapshot|null: Captured routing payload; null when the collector never started.