inspector-apm / cakephp
Code Execution Monitoring for CakePHP applications, powered by Inspector.
Package info
github.com/inspector-apm/cakephp
Type:cakephp-plugin
pkg:composer/inspector-apm/cakephp
Requires
- php: >=8.2
- cakephp/cakephp: ^5.3
- inspector-apm/inspector-php: ^3.17
Requires (Dev)
- cakephp/cakephp-codesniffer: ^5.3
- cakephp/queue: ^2.3.1
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5.3 || ^12.1.3 || ^13.0
- rector/rector: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Before moving on, please consider giving us a GitHub star ⭐️. Thank you!
Code Execution Monitoring for CakePHP applications.
- Requirements
- Install
- Configure the Ingestion Key
- Enable the plugin
- What is monitored
- Test everything is working
- Configuration
- AI Assisted Integration
Requirements
- PHP >= 8.2
- CakePHP >= 5.3
Install
Install the latest version by:
composer require inspector-apm/cakephp
Configure the Ingestion Key
First put the Ingestion Key in your environment file:
INSPECTOR_INGESTION_KEY=[ingestion key]
You can obtain an INSPECTOR_INGESTION_KEY creating a new project in your
Inspector account.
Enable the plugin
Load the plugin in your src/Application.php bootstrap:
public function bootstrap(): void { parent::bootstrap(); // ... $this->addPlugin('Inspector/Cakephp'); }
That is all. Monitoring middleware, console listeners and the reliability
monitors are attached automatically. Without an ingestion key the plugin is a
safe no-op, so the addPlugin() call can be committed unconditionally.
What is monitored
- HTTP requests — one transaction per request, with request/response context, masked parameters, the authenticated user, and errors.
- Console commands —
bin/cake ...executions ascommandtransactions. - Database queries —
db.{connection}segments with SQL and (masked) bindings. - Cache operations —
cache.*segments. - View rendering — a
viewsegment per rendered template. - HTTP client — a segment per outbound request.
- Queue jobs — one
jobtransaction per processed job (withcakephp/queue). - Logs and exceptions — application log messages as transaction context, and unhandled exceptions reported automatically.
Test everything is working
Run the command below:
bin/cake inspector test
Go to https://app.inspector.dev to explore your data.
Configuration
Every setting is optional and can be provided through environment variables
(resolved by the bundled defaults) or an application override file at
config/app_inspector.php:
<?php return [ 'Inspector' => [ 'ignore_url' => ['health*'], 'hidden_parameters' => ['password', 'api_token'], 'cache' => false, ], ];
Frequently used environment variables:
| Variable | Default | Purpose |
|---|---|---|
INSPECTOR_INGESTION_KEY |
(none) | Ingestion key. Activates the agent when set. |
INSPECTOR_API_KEY |
(none) | Legacy alias for the ingestion key. |
INSPECTOR_ENABLE |
true |
Force-disable (false) even with a key present. |
INSPECTOR_URL |
https://ingest.inspector.dev |
Ingestion endpoint (self-hosted). |
INSPECTOR_TRANSPORT |
async |
async (non-blocking) or sync. |
INSPECTOR_MAX_ITEMS |
100 |
Max items recorded per execution cycle. |
INSPECTOR_COMMANDS |
true |
Monitor console commands. |
INSPECTOR_QUERY |
true |
Record database queries as segments. |
INSPECTOR_QUERY_BINDINGS |
true |
Include (masked) query bindings. |
INSPECTOR_CACHE |
true |
Record cache operations. |
INSPECTOR_VIEWS |
true |
Record view rendering. |
INSPECTOR_HTTP_CLIENT |
true |
Record outbound HTTP client requests. |
INSPECTOR_HTTP_CLIENT_BODY |
false |
Include outbound request/response bodies. |
INSPECTOR_JOBS |
true |
Monitor cakephp/queue jobs. |
INSPECTOR_JOB_DATA |
true |
Include the job payload in the transaction. |
INSPECTOR_LOGS |
true |
Capture application log messages. |
INSPECTOR_UNHANDLED_EXCEPTIONS |
true |
Report unhandled exceptions. |
INSPECTOR_USER |
true |
Attach the authenticated user to transactions. |
INSPECTOR_RESPONSE_BODY |
false |
Include the response body in request context. |
List settings (ignore_url, ignore_commands, ignore_jobs,
hidden_parameters) and the remaining options are configured through
config/app_inspector.php, where list values are appended to the shipped
defaults rather than replacing them.
Note: the plugin defaults load after
config/app_local.php, so putInspectoroverrides inconfig/app_inspector.php(notapp_local.php).
Agentic Integration
You can connect the Inspector library documentation to your coding assistant as a Model Context Protocol (MCP) server.
It makes it easy for tools like Claude Code, Cursor, and VS Code extensions reliably understand what Inspector client library can do, its configurations, how to use it.
Official documentation
Check out the official documentation
Contributing
We encourage you to contribute to Inspector! Please check out the Contribution Guidelines about how to proceed. Join us!
LICENSE
This package is licensed under the MIT license.