CakePHP implementation guide

Identify which customers are affected by CakePHP API failures.

A global error rate tells you that something failed. Matched routes and explicit account identity tell you who experienced it—without copying customer payloads into another system.

01 · Capture the route outcome

Instrument CakePHP after routing.

CakePHP's routing middleware provides a bounded route template such as /api/invoices/{id}. Apirelio records that template, the final status, duration and release instead of the concrete URL.

src/Application.phpphp
use Apirelio\CakePHP\ApirelioMiddleware;
use Apirelio\CakePHP\Config as ApirelioConfig;

$middlewareQueue
    ->add(new RoutingMiddleware($this))
    ->add(new ApirelioMiddleware(new ApirelioConfig(
        apiKey: (string) env('APIRELIO_API_KEY'),
        service: 'billing-api',
        paths: ['/api/*'],
        bufferPath: LOGS.'apirelio-events.ndjson',
    )));

02 · Add customer context

Resolve the account your API already authenticated.

The resolver reads your own identity object and emits only a stable account identifier and optional display attributes. It does not inspect the request body.

Customer resolverphp
$apirelio = new ApirelioMiddleware(
    config: $config,
    customerResolver: static function ($request): ?ApirelioCustomer {
        $account = $request->getAttribute('identity')?->getOriginalData();

        return $account === null ? null : new ApirelioCustomer(
            id: (string) $account->id,
            name: $account->name,
            plan: $account->plan,
        );
    },
);

03 · Continue debugging

Use Apirelio to narrow the evidence.

Start with the affected customers, matched endpoint, release and time window. Then continue through the request or trace identifiers in your own application logs. Payload-dependent bugs still require a safe reproduction or evidence retained under your own controls.

Answer impact first

See whether the failure is isolated to one integration or affects the whole customer base.

Correlate internally

Use the narrowed route, release and time window to find the relevant application log or trace.

×

Keep payloads out

Bodies, cookies, credentials, query strings and exception messages never enter the event.

Try the complete workflow

Connect a CakePHP API in minutes.

Follow the production setup guide or explore the customer-impact dashboard with simulated data.