PHP SDK

traceiq/traceiq-php for PHP 8.1+ — a zero-dependency Composer package. Events are queued and flushed in batches; PHP has no background threads, so flushing is synchronous at flush_at and on request shutdown.

bash
composer require traceiq/traceiq-php
php
use TraceIQ\Client;

$traceiq = new Client(
    projectId: "YOUR_PROJECT_ID",
    writeKey: "YOUR_WRITE_KEY",
    endpoint: "https://api.traceiq.run",
);

$traceiq->capture(
    event: "payout_succeeded",
    userId: "user_123",
    properties: ["amount" => 50000, "currency" => "NGN"],
);

$traceiq->shutdown(); // flush before a short-lived process exits

Structured logs are queued and flushed with events. Flag calls are synchronous requests, so evaluate once per request with evaluateFlags() when you check several flags.

php
$traceiq->log('error', 'Payout provider timed out', ['provider' => 'stripe', 'error' => $e]);

if ($traceiq->isFeatureEnabled('new-payouts', 'user_123', properties: ['plan' => 'pro'])) {
    // ...
}