Monitor your CodeIgniter application in production

Inspector records HTTP requests, Spark commands and database queries, and gives your coding agent the data it needs to fix what goes wrong.

What Inspector records

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

  • HTTP requests
  • Spark commands
  • Database queries
  • 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 CodeIgniter

  1. 1

    Install the package

    Add the package with Composer.

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

    Publish the configuration

    This creates Inspector.php in your app/Config directory.

    Terminal
    php spark inspector:install
  3. 3

    Add your ingestion key

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

    .env
    inspector.ingestionKey = 'your-ingestion-key'
  4. 4

    Add the exception handler

    Report exceptions to Inspector from the handler method.

    app/Config/Exceptions.php
    public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface
    {
        InspectorExceptionHandler::handle($statusCode, $exception);
    
        return new ExceptionHandler($this);
    }
  5. 5

    Monitor HTTP requests

    Add the inspector filter to the global filters to monitor every request.

    app/Config/Filters.php
    public array $globals = [
        'before' => [
            // ...
            'inspector',
        ],
        'after' => [
            // ...
            'inspector',
        ],
    ];
  6. 6

    Verify and deploy

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

    Terminal
    php spark 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.