EventCollector
API reference › Yii3 Debug › Collector › EventCollector
Captures PSR-14 event metadata for the current request.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$captureContext | bool | Opt-in capture of whitelisted lifecycle context. Arbitrary event properties remain unread. Default: false. | EventCollector |
$traceLimit | int | Opt-in argument-free trace depth; zero disables capture, and sixteen is the hard maximum. Default: 0. | EventCollector |
Methods
Section titled “Methods”| Method | Description | Defined 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 |
Method details
Section titled “Method details”capture()
Section titled “capture() ”public function capture(): array<string, mixed>|nullEncodes 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(): stringReturns the stable identifier of this collector.
Returns
string: Stable ID pairing this collector with its panel.
record()
Section titled “record() ”public function record(object $event, string $senderClass = ''): voidRecords only dispatch metadata while collection is active.
Parameters
| Parameter | Type | Description |
|---|---|---|
$event | object | Event being dispatched. |
$senderClass | string | Immediate class that invoked the decorated dispatcher, used as a fallback source. |
shutdown()
Section titled “shutdown() ”public function shutdown(): voidStops capturing and clears the events accumulated for the request.
startup()
Section titled “startup() ”public function startup(): voidStarts capturing and resets the nesting and scope counters.