Skip to content

SDKs

PHP SDK

Send server-side events, evaluate feature flags and report exceptions from PHP and Laravel.

Install

Terminal
composer require tracklyne/tracklyne-php
index.php
$tracklyne = new Tracklyne\Client('tl_your_project_token', ['host' => 'https://tracklyne.com']);

$tracklyne->capture(['distinct_id' => $user->id, 'event' => 'invoice paid']);

Feature flags and errors

index.php
if ($tracklyne->isFeatureEnabled('new-billing', $user->id)) {
    // ship it to this user
}

try { work(); } catch (Throwable $e) { $tracklyne->captureException($e, $user->id); }

Events are sent at the end of the request. In a queue worker, call flush() after each job. PHP 8.1+; the README has the Laravel setup.