Skip to content
PHP Ecosystem
Explore

DumpCollector

API reference › Yii3 Debug › Collector › DumpCollector

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

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.

MethodDescriptionDefined 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
public function capture(): array<string, mixed>|null

Encodes the captured dumps into the Dump panel payload.

Returns

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

public function collect(mixed $variable, int $depth, bool $highlight, list<Yii3\Debug\Collector\TraceFrame> $trace): void

Records 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

ParameterTypeDescription
$variablemixedDumped value.
$depthintMaximum nesting depth requested by the caller.
$highlightboolWhether the caller requested syntax-highlighted output.
$tracelist<Yii3\Debug\Collector\TraceFrame>Call-site frame of the dump, or an empty list when unknown.
public function id(): string

Returns the stable identifier of this collector.

Returns

string: Stable ID pairing this collector with its panel.

public function shutdown(): void

Stops 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.

public function startup(): void

Starts capturing by installing a DumpHandlerProxy around the current var-dumper default handler.