VarDumper — Variable Dumps
You call dump() or dd() and the output lands in the browser response, mixes with HTML, or gets lost in CLI output. With Buggregator, dumps go to a dedicated TCP server and show up in a clean UI — alongside your logs, exceptions, and everything else. No browser pollution, no output buffering issues, no lost dumps in long-running processes.
Use cases
- Long-running apps (RoadRunner, Swoole, queue workers) —
dd()doesn't print to a browser here, but Buggregator catches it. - API development — dump variables without breaking JSON responses.
- Microservices — collect dumps from all services in one place.
- IDE integration — click the source location to jump straight to the file in your editor.
What you see in the UI
- Dumped value — full variable content with type information, rendered as an interactive expandable tree.
- Source location — file and line where
dump()was called. Clickable — opens in your IDE. - Variable name and label — custom labels if provided.
- Syntax highlighting — for text-only dumps (see below).
Setup
Install the Symfony VarDumper component:
composer require --dev symfony/var-dumperSet two env variables to redirect output to Buggregator:
VAR_DUMPER_FORMAT=server
VAR_DUMPER_SERVER=127.0.0.1:9912In Docker Compose, replace
127.0.0.1with the Buggregator service name (e.g.,VAR_DUMPER_SERVER=buggregator:9912).
That's it. Use dump() and dd() as usual — the output goes to Buggregator.
If your project doesn't use .env files, set via PHP:
$_SERVER['VAR_DUMPER_FORMAT'] = 'server';
$_SERVER['VAR_DUMPER_SERVER'] = '127.0.0.1:9912';Performance tip
Large objects with deep nesting can slow down the browser. Limit the preview depth on the events list page:
docker run --pull always \
-p 127.0.0.1:8000:8000 \
-p 127.0.0.1:9912:9912 \
-e VAR_DUMPER_PREVIEW_MAX_DEPTH=3 \
ghcr.io/buggregator/server:latestThe full dump is still available when you open the event detail page.
Syntax highlighting
Dump a text string with syntax highlighting using Buggregator Trap:
$code = <<<PHP
<?php
declare(strict_types=1);
echo 'Hello, World!';
PHP;
trap($code)->context(language: 'php');Buggregator Trap
Consider using Buggregator Trap instead of raw VarDumper — it uses VarDumper under the hood but adds extra features like trap(), tr(), and td() helpers.