Skip to content
PHP Ecosystem
Explore

DumpHandlerProxy

API reference › Yii3 Debug › Dump › DumpHandlerProxy

final readonly classYii3\Debug\Dump\DumpHandlerProxy
ImplementsYiisoft\VarDumper\HandlerInterface
Sourcesrc/Dump/DumpHandlerProxy.php

Intercepts yiisoft/var-dumper dumps to feed the DumpCollector, then forwards each dump unchanged.

DumpCollector::startup() installs the proxy as the var-dumper default handler, so VarDumper::dump() and the yiisoft/var-dumper helpers d(), dump(), and dd() pass through it while the application output stays exactly what the decorated handler produces. When symfony/var-dumper is loaded first, as Codeception and PsySH do, its own global dump() and dd() are defined instead and never reach this proxy.

MethodDescriptionDefined by
__construct()Creates a dump-handler proxy that records and then forwards each dump.DumpHandlerProxy
handle()Records the dump with its call site, then forwards it to the decorated handler.DumpHandlerProxy
handler()Returns the handler the proxy decorates.DumpHandlerProxy
public function __construct(Yiisoft\VarDumper\HandlerInterface $handler, Yii3\Debug\Collector\DumpCollector $collector)

Creates a dump-handler proxy that records and then forwards each dump.

Parameters

ParameterTypeDescription
$handlerYiisoft\VarDumper\HandlerInterfaceHandler that was the default before the proxy, receiving every dump.
$collectorYii3\Debug\Collector\DumpCollectorCollector recording the dumps of the request.
public function handle(mixed $variable, int $depth, bool $highlight = false): void

Records the dump with its call site, then forwards it to the decorated handler.

Recording comes first, so the dump is already in the collector when the decorated handler throws, or when dd() ends the script right after the output and DeferredCapture writes the capture armed for the request at shutdown.

Parameters

ParameterTypeDescription
$variablemixedDumped value.
$depthintMaximum nesting depth requested by the caller.
$highlightboolWhether the caller requested syntax-highlighted output.
public function handler(): Yiisoft\VarDumper\HandlerInterface

Returns the handler the proxy decorates.

Returns

Yiisoft\VarDumper\HandlerInterface: Handler receiving every forwarded dump.