Skip to main content

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

bash
docker run --pull always \
  -p 127.0.0.1:8000:8000 \
  ghcr.io/buggregator/server:latest

2. Install the package

bash
composer require inspector-apm/inspector-laravel

3. Point it at Buggregator

Four lines in .env. The keys can be any value.

dotenv
INSPECTOR_URL=http://inspector@127.0.0.1:8000
INSPECTOR_API_KEY=test
INSPECTOR_INGESTION_KEY=1test
INSPECTOR_ENABLE=true

In 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:

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).

Checked on with Buggregator v2.13.0

Setup in 60 seconds

No registration. No account. Start it and point your app at it.

1

Start Buggregator

One file, installed with one command. The web UI opens on port 8000. Prefer containers? Use the Docker tab.

$ curl -fsSL https://raw.githubusercontent.com/buggregator/server/master/scripts/install.sh | sh
$ HTTP_ADDR=127.0.0.1:8000 \
  SMTP_ADDR=127.0.0.1:1025 \
  VAR_DUMPER_ADDR=127.0.0.1:9912 \
  MONOLOG_ADDR=127.0.0.1:9913 \
  PROXY_ADDR=127.0.0.1:8080 \
  ~/.local/bin/buggregator

The script picks the file for your CPU: Intel/AMD or ARM.

One file for Linux, macOS and Windows, about 40 MB. Nothing else to install.

This run line keeps it on this computer. Without the *_ADDR settings it listens on all network interfaces

Rather not run a script? Download the file yourself

Runs on Windows, macOS and Linux, on Intel/AMD and ARM.

Prefer not to do it yourself? Your AI agent can set Buggregator up for you