dump() without breaking your page or JSON response
Use Buggregator as your Laravel dump server: set VAR_DUMPER_FORMAT=server and VAR_DUMPER_SERVER=127.0.0.1:9912, and dump() output goes to the Buggregator UI instead of your HTML page or JSON response. Each dump shows the value as an expandable tree and the file and line where you called it.
Steps
1. Install Symfony VarDumper
Laravel already includes it. In other PHP projects, add it as a dev dependency.
composer require --dev symfony/var-dumper2. Point VarDumper at Buggregator
Add two lines to your .env. In Docker Compose, replace 127.0.0.1 with the Buggregator service name, for example buggregator:9912.
VAR_DUMPER_FORMAT=server
VAR_DUMPER_SERVER=127.0.0.1:99123. Or set them in PHP
If your project does not use .env files, set the same values in code.
$_SERVER['VAR_DUMPER_FORMAT'] = 'server';
$_SERVER['VAR_DUMPER_SERVER'] = '127.0.0.1:9912';4. Call dump() as usual
Open http://127.0.0.1:8000. Your response stays clean: no dump HTML mixed into the page or the JSON. Click the source location to open the file in your editor. This also works in queue workers, RoadRunner and Swoole, where a dump never reaches a browser.
dd() is sent to Buggregator too, but it still stops the script, as it always does.
Why it works
VarDumper has a server mode. With VAR_DUMPER_FORMAT=server, it sends each dump over TCP to the address in VAR_DUMPER_SERVER instead of printing it. Buggregator listens on port 9912 and renders what arrives. One limit: on the Windows binary, the VarDumper module (port 9912) does not work.
Related tips
- Dumps
Send ray() calls to a free local viewer
Set RAY_HOST and RAY_PORT in your Laravel .env. Your ray() calls, queries, jobs and mails show up in Buggregator, free and MIT licensed.
- Logs
Laravel logs from web, queue and cron in one live view
Add a socket channel to config/logging.php and set LOG_CHANNEL=socket. Laravel logs from requests, queue workers and cron jobs appear live in Buggregator.
- Logs
Symfony logs in a live view, context as JSON
Add one Monolog socket handler with the JSON formatter, and your Symfony logs appear live in Buggregator with channel, level and context.
Checked on with Buggregator v2.8.0