Skip to content
PHP Ecosystem
Explore

CollectorRegistrar

API reference › Debug › service › CollectorRegistrar

classyii\debug\service\CollectorRegistrar
Sourcesrc/service/CollectorRegistrar.php

Resolves the configured debug collectors and validates their stable IDs before request capture.

Built-in collectors are omitted when their optional package is unavailable. Explicit application configuration remains authoritative and may still register a custom collector under the same ID.

PropertyTypeDescriptionDefined by
$module protected readonly constructoryii\debug\ModuleDebug module owning the collectors and read for configuration at call time.CollectorRegistrar
MethodDescriptionDefined by
__construct()Binds collector registration to the debug module.CollectorRegistrar
register()Instantiates every configured collector, instruments it, and returns the coordinator driving the capture.CollectorRegistrar
public function __construct(yii\debug\Module $module)

Binds collector registration to the debug module.

Parameters

ParameterTypeDescription
$moduleyii\debug\ModuleDebug module owning the collectors and read for configuration at call time.
public function register(array<string, array<string, mixed>|string> $core, array<array-key, array<string, mixed>|Closure(PHPForge\Debug\Capture\CapturePolicy): mixed|PHPForge\Debug\CollectorInterface|string> $configured): PHPForge\Debug\Collector\CollectorCoordinator

Instantiates every configured collector, instruments it, and returns the coordinator driving the capture.

An array entry declaring enabled as false is skipped before its class is resolved, so an uninstalled optional package is not an error. A Closure entry receives the module CapturePolicy, built once per call, so a provider collector redacts with the rules the Request panel applies.

Every Module::$dispatchers key must name a registered or a disabled collector, so a mistyped entry fails here instead of leaving its panel silently empty.

Each resolved collector is instrumented right away through Collector::instrument(): the panels are built afterwards and a panel constructor may already hit the framework, so instrumentation installed only at Application::EVENT_BEFORE_REQUEST would miss the debugger’s own bootstrap work.

Parameters

ParameterTypeDescription
$corearray<string, array<string, mixed>|string>Built-in collector definitions indexed by collector ID.
$configuredarray<array-key, array<string, mixed>|Closure(CapturePolicy): mixed|CollectorInterface|string>Collector definitions declared by the application; a Closure result is validated at call time.

Returns

PHPForge\Debug\Collector\CollectorCoordinator: Coordinator holding the registered collectors in resolution order.

Throws