Inspector transactions from Laravel, locally
Install the Inspector package for Laravel and set INSPECTOR_URL=http://inspector@127.0.0.1:8000 in .env. Each monitored request then lands in Buggregator instead of Inspector's cloud: its duration, peak memory, result and a timeline of what ran inside it.
Steps
1. Start Buggregator
docker run --pull always \
-p 127.0.0.1:8000:8000 \
ghcr.io/buggregator/server:latest2. Install the package
composer require inspector-apm/inspector-laravel3. Point it at Buggregator
Four lines in .env. The keys can be any value.
INSPECTOR_URL=http://inspector@127.0.0.1:8000
INSPECTOR_API_KEY=test
INSPECTOR_INGESTION_KEY=1test
INSPECTOR_ENABLE=trueIn Docker Compose, use the service name: INSPECTOR_URL=http://inspector@buggregator:8000.
4. Attach the middleware
To monitor HTTP requests, add Inspector's middleware to your route groups. In Laravel 11 and newer, in bootstrap/app.php:
use Inspector\Laravel\Middleware\WebRequestMonitoring;
return Application::configure(basePath: dirname(__DIR__))
->withMiddleware(function (Middleware $middleware) {
$middleware->appendToGroup('web', WebRequestMonitoring::class)
->appendToGroup('api', WebRequestMonitoring::class);
})
->create();In Laravel 10 and older, add the same class to the web and api groups in app/Http/Kernel.php.
5. Load a page and open it
Open http://127.0.0.1:8000. Each transaction shows its name, type, duration in milliseconds, peak memory, result, the HTTP method, URI and host, and a timeline of the work inside the request.
Why it works
The Inspector SDK sends its data to the URL in INSPECTOR_URL. Buggregator accepts the same protocol on port 8000 and shows the transaction next to your errors, logs and dumps. To send to another project, put its key after inspector: in the URL, for example http://inspector:shop@127.0.0.1:8000 (server 2.11.0 or newer).
Related tips
- Profiler
Find the slow function in a Laravel page
Install XHProf and one Laravel package, point it at Buggregator, and read the flamechart and top functions of every request.
- OpenTelemetry
Laravel OpenTelemetry traces on your machine
Add OpenTelemetry auto-instrumentation to Laravel and send OTLP to Buggregator on port 8000. Each request shows as a span waterfall, no Jaeger needed.
- 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.
Checked on with Buggregator v2.13.0