DumpCollector
API reference › Yii3 Debug › Collector › DumpCollector
Captures the values dumped through yiisoft/var-dumper during the request for the Dump panel.
Yii3 has no Yii::debug(), so the capture point is the var-dumper default handler: startup() decorates it with
a DumpHandlerProxy and shutdown() puts it back. Each dump is recorded in the logger-tuple shape the
Yii2 collector produces (trace level, application category, call-site frame), so a capture written by either host
renders through the same DumpCardRenderer.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
capture() | Encodes the captured dumps into the Dump panel payload. | DumpCollector |
collect() | Records one dump, pre-rendered the way the application output shows it. | DumpCollector |
id() | Returns the stable identifier of this collector. | DumpCollector |
shutdown() | Stops capturing, clears the recorded dumps, and restores the var-dumper default handler. | DumpCollector |
startup() | Starts capturing by installing a DumpHandlerProxy around the current var-dumper default handler. | DumpCollector |
Method details
Section titled “Method details”capture()
Section titled “capture() ”public function capture(): array<string, mixed>|nullEncodes the captured dumps into the Dump panel payload.
Returns
array<string, mixed>|null: Encoded Dump panel payload; null when the collector never started.
collect()
Section titled “collect() ”public function collect(mixed $variable, int $depth, bool $highlight, list<Yii3\Debug\Collector\TraceFrame> $trace): voidRecords one dump, pre-rendered the way the application output shows it.
The value is rendered with the depth and highlighting the caller requested: highlighted output is the markup
var-dumper’s EchoHandler prints, which the Dump card keeps; plain output is HTML-encoded, as the Yii2
collector does, because the card renders the message as markup.
Parameters
| Parameter | Type | Description |
|---|---|---|
$variable | mixed | Dumped value. |
$depth | int | Maximum nesting depth requested by the caller. |
$highlight | bool | Whether the caller requested syntax-highlighted output. |
$trace | list<Yii3\ | Call-site frame of the dump, or an empty list when unknown. |
public function id(): stringReturns the stable identifier of this collector.
Returns
string: Stable ID pairing this collector with its panel.
shutdown()
Section titled “shutdown() ”public function shutdown(): voidStops capturing, clears the recorded dumps, and restores the var-dumper default handler.
The previous handler is restored only while the proxy is still the default, so a handler the application installed during the request is kept; a proxy left in its chain forwards without recording.
startup()
Section titled “startup() ”public function startup(): voidStarts capturing by installing a DumpHandlerProxy around the current var-dumper default handler.