Spiral errors through the Sentry bridge, locally
Install spiral/sentry-bridge, register SentryReporterBootloader in your Kernel and set SENTRY_DSN=http://sentry@127.0.0.1:8000/1. Every exception your Spiral app reports then shows up in Buggregator with its stack trace. You need no Sentry account. Errors from RoadRunner workers, which never reach the browser, land there too.
Steps
1. Start Buggregator
Run the container. Port 8000 is the web UI and also takes Sentry data.
docker run --pull always \
-p 127.0.0.1:8000:8000 \
-p 127.0.0.1:1025:1025 \
-p 127.0.0.1:9912:9912 \
-p 127.0.0.1:9913:9913 \
ghcr.io/buggregator/server:latest2. Install the bridge
composer require spiral/sentry-bridge3. Register the bootloader
Add SentryReporterBootloader in app/src/Application/Kernel.php. It hooks the Sentry reporter into Spiral's exception handler.
public function defineBootloaders(): array
{
return [
// ...
\Spiral\Sentry\Bootloader\SentryReporterBootloader::class,
// ...
];
}To attach your app's recent log messages to each error, register \Spiral\Bootloader\Debug\LogCollectorBootloader before it.
4. Point the DSN at Buggregator
One line in .env. Keep the number in the path: the data then goes to the default project.
SENTRY_DSN=http://sentry@127.0.0.1:8000/1In Docker Compose, replace 127.0.0.1 with the Buggregator service name, for example buggregator.
5. Throw an exception and open it
Throw an exception in a controller or a console command. Open http://127.0.0.1:8000. The error shows its stack trace frame by frame, with the request and the other context the SDK sends.
Why it works
The bridge wraps the Sentry PHP SDK. Buggregator accepts the same protocol the SDK uses, so the DSN is the only thing that tells it where to send. Your Spiral code does not change.
Related tips
- Profiler
Find the slow function in a Spiral request
Install XHProf and spiral/profiler, add its bootloader and middleware, and read each Spiral request's call graph and top functions in Buggregator.
- Sentry
Symfony errors in a Sentry-style view, no account
Install sentry/sentry-symfony, turn it on for dev and set SENTRY_DSN to Buggregator. Exceptions show with stack trace, request and breadcrumbs.
- 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
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.
Checked on with Buggregator v2.13.0