FlightPHP implementation guide

Identify which customers are affected by FlightPHP 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 a Flight route group.

Flight provides a bounded matched route such as /api/invoices/@id. Apirelio records that pattern, route alias, final status, duration and release instead of the concrete URL.

public/index.phpphp
use Apirelio\FlightPHP\ApirelioMiddleware;
use Apirelio\FlightPHP\Config;
use flight\Engine;

$app = new Engine;
$apirelio = new ApirelioMiddleware($app, new Config(
    apiKey: $_ENV['APIRELIO_API_KEY'],
    service: 'billing-api',
    paths: ['/api/*'],
    bufferPath: __DIR__.'/../var/apirelio/events.ndjson',
));

$app->group('/api', function () use ($app): void {
    $app->get('/invoices/@id', [InvoiceController::class, 'show'], false, 'invoices:view');
}, [$apirelio]);

02 · Add customer context

Resolve the account your API already authenticated.

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

Customer resolverphp
$apirelio = new ApirelioMiddleware(
    app: $app,
    config: $config,
    customerResolver: static function (Engine $app): ?ApirelioCustomer {
        $account = $app->get('authenticatedAccount');

        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 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 FlightPHP API in minutes.

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