Mail, errors, logs and dumps in Laravel Sail, one service
Add one buggregator service to Sail's compose.yaml and point a few .env lines at it. Your Laravel app then sends its emails, Sentry errors, log records and dump() output to one local UI at http://127.0.0.1:8000. You can drop the mailpit service once mail goes to Buggregator.
Steps
1. Add the service
Sail keeps its services in compose.yaml (older apps: docker-compose.yml). Add this under services::
buggregator:
image: 'ghcr.io/buggregator/server:latest'
ports:
- '127.0.0.1:8000:8000'
networks:
- sailOnly the web UI port is published. Your app reaches mail, logs and dumps over the sail network by the name buggregator. If APP_PORT is 8000, publish the UI on another port, for example '127.0.0.1:8001:8000'.
Start it with ./vendor/bin/sail up -d.
2. Mail
MAIL_MAILER=smtp
MAIL_HOST=buggregator
MAIL_PORT=10253. Errors
Install the Sentry SDK with ./vendor/bin/sail composer require sentry/sentry-laravel, then:
SENTRY_LARAVEL_DSN=http://sentry@buggregator:8000/1
SENTRY_TRACES_SAMPLE_RATE=1.0Laravel 11 and later also need this in bootstrap/app.php, or exceptions are not reported:
->withExceptions(function (Exceptions $exceptions): void {
\Sentry\Laravel\Integration::handles($exceptions);
})4. Logs
Add a socket channel to config/logging.php, as the Monolog docs show for Laravel, then:
LOG_CHANNEL=socket
LOG_SOCKET_URL=buggregator:9913If Buggregator is not running, this channel throws, and even artisan commands fail. Set it only in your local .env.
5. Dumps
VAR_DUMPER_FORMAT=server
VAR_DUMPER_SERVER=buggregator:9912dump() and dd() now go to Buggregator instead of the page or the console.
6. Check all four at once
Add this to routes/console.php and run ./vendor/bin/sail artisan buggregator:check:
Artisan::command('buggregator:check', function () {
\Illuminate\Support\Facades\Mail::raw('Hello', fn ($m) => $m->to('dev@example.com')->subject('Check'));
\Illuminate\Support\Facades\Log::info('Hello from Laravel');
dump(['hello' => 'Buggregator']);
throw new RuntimeException('Check error');
});Open http://127.0.0.1:8000. You see an email «Check», a log record «Hello from Laravel», a dump and a Sentry error «Check error».
Why it works
One Buggregator container listens on four ports inside the sail network: SMTP on 1025, the Sentry API on 8000, Monolog on 9913 and VarDumper on 9912. Laravel's own mailer, the Sentry SDK, the socket log channel and Symfony's dump server each send to their port, and Buggregator shows all of it in one UI.
Related tips
- Mail
Laravel mail to a local inbox, three .env lines
Set MAIL_MAILER, MAIL_HOST and MAIL_PORT in .env and every Laravel email lands in Buggregator with HTML preview and attachments. Nothing is delivered.
- Sentry
Laravel errors in Sentry's UI style, no Sentry account
Set SENTRY_LARAVEL_DSN to Buggregator. Each Laravel exception shows locally with its stack trace, request and breadcrumbs. No account, no limits.
- 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.
- Dumps
dump() without breaking your page or JSON response
Send Symfony VarDumper output to Buggregator with two env vars. dump() stops landing in your HTML or JSON and shows the file and line it came from.
Checked on with Buggregator v2.13.0