Skip to content
PHP Ecosystem
Explore

EventCollector

API reference › Yii3 Debug › Collector › EventCollector

final classYii3\Debug\Collector\EventCollector
ImplementsCollectorInterface
Sourcesrc/Collector/EventCollector.php

Captures PSR-14 event metadata for the current request.

PropertyTypeDescriptionDefined by
$captureContextboolOpt-in capture of whitelisted lifecycle context. Arbitrary event properties remain unread. Default: false.EventCollector
$traceLimitintOpt-in argument-free trace depth; zero disables capture, and sixteen is the hard maximum. Default: 0.EventCollector
MethodDescriptionDefined by
capture()Encodes the captured events into the Events panel payload.EventCollector
id()Returns the stable identifier of this collector.EventCollector
record()Records only dispatch metadata while collection is active.EventCollector
shutdown()Stops capturing and clears the events accumulated for the request.EventCollector
startup()Starts capturing and resets the nesting and scope counters.EventCollector
public function capture(): array<string, mixed>|null

Encodes the captured events into the Events panel payload.

Returns

array<string, mixed>|null: Encoded Events panel payload; null when the collector never started.

public function id(): string

Returns the stable identifier of this collector.

Returns

string: Stable ID pairing this collector with its panel.

public function record(object $event, string $senderClass = ''): void

Records only dispatch metadata while collection is active.

Parameters

ParameterTypeDescription
$eventobjectEvent being dispatched.
$senderClassstringImmediate class that invoked the decorated dispatcher, used as a fallback source.
public function shutdown(): void

Stops capturing and clears the events accumulated for the request.

public function startup(): void

Starts capturing and resets the nesting and scope counters.