Laravel errors in Sentry's UI style, no Sentry account
Install sentry/sentry-laravel and set one line in .env: SENTRY_LARAVEL_DSN=http://sentry@127.0.0.1:8000/1. Every exception your Laravel app reports then shows up in Buggregator on your machine, with the stack trace, the request and the breadcrumbs that led to it. No Sentry account is needed.
Steps
1. Start Buggregator
docker run --pull always \
-p 127.0.0.1:8000:8000 \
ghcr.io/buggregator/server:latest2. Install the SDK
composer require sentry/sentry-laravel3. Set the DSN
One line in .env. Keep the number at the end: events then go to the default project, which the UI shows from the start.
SENTRY_LARAVEL_DSN=http://sentry@127.0.0.1:8000/1In Docker Compose, replace 127.0.0.1 with the Buggregator service name, for example buggregator.
4. Hook it into Laravel 11 and later
Laravel 11 and later need one line in bootstrap/app.php. Without it, exceptions are not reported:
->withExceptions(function (Exceptions $exceptions): void {
\Sentry\Laravel\Integration::handles($exceptions);
})5. Throw and look
Throw an exception in a route and open the page, then open http://127.0.0.1:8000. The error shows the stack trace frame by frame with code around each line, the request method, URL and headers, the breadcrumbs before the error, tags and loaded packages.
Why it works
The Sentry SDK sends each exception over HTTP to the address in the DSN. Buggregator speaks the same protocol on port 8000, so the SDK sends to it as it would to Sentry, and Buggregator stores and shows the event. Your error handling code stays the same; only the DSN changes.
Related tips
- Sentry
See what happened right before the exception
Point your Laravel Sentry DSN at Buggregator. Each error shows its breadcrumbs, request, tags and stack trace on your laptop.
- Sentry
See a Laravel request's Sentry trace as a waterfall
Turn on Sentry tracing in Laravel and send it to Buggregator. Every span of a request shows on a timeline, and errors link to their trace.
- Sentry
Laravel queue job errors next to web errors
Set SENTRY_LARAVEL_DSN for your queue worker too. A failing job's exception lands in Buggregator with the job class, queue and attempt as a breadcrumb.
- 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.
Checked on with Buggregator v2.13.0