PHP / Laravel
The Whisperr server-side SDK for PHP, with first-class Laravel support. The backend is where the highest-signal churn events live — payment failures, cancellations, trial expiry, usage drops — so this is where Whisperr gets its most valuable signal.
composer require whisperr/phpLaravel
Section titled “Laravel”The service provider and Whisperr facade auto-register via package
discovery. Set your key and (optionally) publish the config:
php artisan vendor:publish --tag=whisperr-configWHISPERR_API_KEY=wrk_...use Whisperr\Laravel\Facades\Whisperr;
// In a controller — source the user id explicitly:Whisperr::track(auth()->id(), 'plan_upgraded', ['plan' => 'pro']);
// In a Stripe webhook / job — use the id from your domain data:Whisperr::track($subscription->user_id, 'payment_failed', ['amount_cents' => 4900]);
// Associate traits / contact channels:Whisperr::identify(auth()->id(), ['traits' => ['plan' => 'pro'], 'email' => $user->email]);Events are buffered during the request and flushed after the response is
sent (via the app’s terminating hook), so tracking adds no latency to
the response.
Plain PHP
Section titled “Plain PHP”use Whisperr\Whisperr;
$whisperr = new Whisperr(['api_key' => getenv('WHISPERR_API_KEY')]);
$whisperr->track('user_8842', 'subscription_cancelled', ['reason' => 'card_declined']);
$whisperr->flush(); // also auto-flushes on shutdownThe user id is always explicit — the server has no session to infer it from. Pass the same id you use everywhere else and frontend + backend events land on one timeline.
Reliability
Section titled “Reliability”- Request-friendly. Events buffer in memory and deliver in a batch on
flush()— automatically after the Laravel response (or on shutdown). Retries are bounded so request teardown never hangs. - Reliable in-process. Batching, retry with backoff, per-event idempotency — the full delivery contract. The buffer lives for the request only; it is not crash-durable.
- No Composer dependencies. Uses
ext-curl+ext-jsononly.
Options (plain-PHP constructor)
Section titled “Options (plain-PHP constructor)”| Key | Default | Notes |
|---|---|---|
api_key |
— | App ingestion key (wrk_…). Required. |
base_url |
https://api.whisperr.net |
Ingestion base URL. |
flush_at |
100 |
Auto-flush when this many events are buffered. |
max_batch_size |
500 |
Events per batch (hard backend cap is 500). |
max_retries |
3 |
Retries before giving up a batch. |
request_timeout |
10.0 |
Per-request timeout (seconds). |
disabled |
false |
No-op client (useful in tests). |
debug |
false |
Verbose logging via error_log. |
on_error |
— | callable(WhisperrError): void for observability. |