TopStats SDK

PHP analytics SDK

PHP has no background threads, so this SDK is honest about it: events buffer in memory and flush on the batch threshold, on an explicit flush(), and in __destruct. Under Octane the buffer survives across requests and batching genuinely pays off. The Laravel package wires it into terminable middleware.

Install

composer require topstats/analytics  # Packagist soon; VCS repo works today

Capture your first event

$client = new \TopStats\Analytics\TopStats(getenv('TOPSTATS_API_KEY'));

$client->capture('invoice_sent', ['total' => 42], ['actor' => 'user-9']);
$client->flush();

Behaviour you can rely on

Every other language

Your first event is minutes away.

Twelve language SDKs, middleware for nine web frameworks, plugins for seven games, and raw HTTP - all working today. Free plan, 2M events a month, no card.