1. Go to this page and download the library: Download vinktarhq/php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vinktarhq / php example snippets
$vinktar = new Vinktar\Client(['writeKey' => getenv('VINKTAR_KEY'), 'captureErrors' => true]);
$vinktar->scopeFromHeaders($_SERVER); // the browser SDK's device and session
$vinktar->identify($user->id, ['plan' => 'pro']);
$vinktar->track('order_created', ['total' => 42]);
$vinktar->track('checkout_started', ['items' => 3]);
$vinktar->page('Pricing'); // $pageview
$vinktar->identify('user_123', ['email' => '[email protected]', 'plan' => 'pro'], ['created' => '2026-01-04']);
$vinktar->setTraits(['plan' => 'team']); // for the scope's user
$vinktar->unsetTraits(['trial_ends_at']);
$vinktar->register(['region' => 'eu-west']); // on every event from this scope
// A job in a long-running worker: everything set inside stays inside.
$vinktar->withScope(function () use ($vinktar, $job) {
$vinktar->setUser(['id' => $job->userId]);
$job->handle();
});
// A framework hook that runs before the handler and does not wrap it.
$vinktar->enterScope();