CollectorRegistrar
API reference › Debug › service › CollectorRegistrar
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.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$module protected readonly constructor | yii\ | Debug module owning the collectors and read for configuration at call time. | CollectorRegistrar |
Methods
Section titled “Methods”| Method | Description | Defined 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 |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(yii\debug\Module $module)Binds collector registration to the debug module.
Parameters
| Parameter | Type | Description |
|---|---|---|
$module | yii\ | Debug module owning the collectors and read for configuration at call time. |
register()
Section titled “register() ”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\CollectorCoordinatorInstantiates 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
| Parameter | Type | Description |
|---|---|---|
$core | array<string, | Built-in collector definitions indexed by collector ID. |
$configured | array<array-key,Closure(CapturePolicy): mixed|CollectorInterface| | 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
yii\base\InvalidConfigException: when a collector configuration, a collector ID, a dispatcher entry, or the resolved set is invalid.