Monitor your Laravel application in production

Inspector records HTTP requests, queued jobs and Artisan commands, and gives your coding agent the data it needs to fix what goes wrong.

Works with Laravel Octane, Laravel Vapor and Laravel Nova.

What Inspector records

Every request in your Laravel application becomes a timeline, so you can see what ran and how long it took.

  • HTTP requests
  • Queued jobs
  • Artisan commands
  • Database queries
  • Errors and exceptions

GET /api/users

Duration
412.00ms
Segments
8
Result
200
  1. select * from `users`38.20ms
  2. select `offices`.*, `office_user`.`user_id` from `offices` inner join `office_user` on `offices`.`id` = `office_user`.`office_id` where `office_user`.`user_id` = ?48.10ms
  3. select `offices`.*, `office_user`.`user_id` from `offices` inner join `office_user` on `offices`.`id` = `office_user`.`office_id` where `office_user`.`user_id` = ?52.40ms
  4. select `offices`.*, `office_user`.`user_id` from `offices` inner join `office_user` on `offices`.`id` = `office_user`.`office_id` where `office_user`.`user_id` = ?44.70ms
  5. select `offices`.*, `office_user`.`user_id` from `offices` inner join `office_user` on `offices`.`id` = `office_user`.`office_id` where `office_user`.`user_id` = ?56.30ms
  6. select `offices`.*, `office_user`.`user_id` from `offices` inner join `office_user` on `offices`.`id` = `office_user`.`office_id` where `office_user`.`user_id` = ?48.90ms
  7. select `offices`.*, `office_user`.`user_id` from `offices` inner join `office_user` on `offices`.`id` = `office_user`.`office_id` where `office_user`.`user_id` = ?54.20ms
  8. redis:get22.60ms
6 identical queries in one request

Then let your coding agent fix it

Connect your coding agent to the MCP server, and it can read the same data, find the cause and change your code.

Coding agentInspector MCP connected

Why is GET /api/users slow in production?

  • worst_performing_transactions shop-api
  • transaction_details GET /api/users

N+1 query in UserController@index. It loads offices once per user, which adds 6 queries to every request.

app/Http/Controllers/UserController.php
- $users = User::all();+ $users = User::with('offices')->get();

Install Inspector in Laravel

  1. 1

    Install the package

    Add the package with Composer.

    Terminal
    composer require inspector-apm/inspector-laravel
  2. 2

    Add your ingestion key

    Paste the key from your Inspector dashboard into the environment file.

    .env
    INSPECTOR_INGESTION_KEY=your-ingestion-key
  3. 3

    Attach the HTTP middleware

    Monitor web and API requests. This is the setup for Laravel 11 and later.

    bootstrap/app.php
    use \Inspector\Laravel\Middleware\WebRequestMonitoring;
    
    return Application::configure(basePath: dirname(__DIR__))
        ->withMiddleware(function (Middleware $middleware) {
            // Append the middleware
            $middleware->appendToGroup('web', WebRequestMonitoring::class)
                ->appendToGroup('api', WebRequestMonitoring::class);
        })
        ->create();
  4. 4

    Test and deploy

    Check your setup. If every check is green, deploy to production.

    Terminal
    php artisan inspector:test

Give your coding agent eyes on production

Install the package, connect your agent, and let it find the next problem before your customers do.

Free up to 30K transactions a month. No credit card.