Monitor your CakePHP application in production

Inspector records HTTP requests, console commands and queue jobs with every query inside them, and gives your coding agent the data it needs to fix what goes wrong.

What Inspector records

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

  • HTTP requests
  • Console commands
  • Queue jobs, with cakephp/queue
  • Database queries
  • Cache operations
  • View rendering
  • Outbound HTTP calls
  • Unhandled 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 CakePHP

  1. 1

    Install the plugin

    Add the plugin with Composer. It needs PHP 8.2 and CakePHP 5.3 or later.

    Terminal
    composer require inspector-apm/cakephp
  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

    Enable the plugin

    Load the plugin when your application boots.

    src/Application.php
    public function bootstrap(): void
    {
        parent::bootstrap();
    
        // ...
        $this->addPlugin('Inspector/Cakephp');
    }
  4. 4

    Verify and deploy

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

    Terminal
    bin/cake 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.