Skip to main content

How to install

Add the package to your composer.json file as a dependency:
Bash
Initialize the client instance and use it to make API requests. You need to specify your secret API key and region (if it is not US/Global).
PHP

Migration guide for PHP SDK v7

Version 7 migrates the SDK from Server API v3 to v4. This is a breaking change. This section summarizes the most important changes from previous versions. PHP SDK v7 requires PHP 8.2 or higher. Support for PHP 8.1 has been dropped.

Package and namespace rename

The Composer package changed from fingerprint/fingerprint-pro-server-api-sdk to fingerprint/server-sdk, and the namespace changed from Fingerprint\ServerAPI to Fingerprint\ServerSdk.
composer.json
Update all use statements to the new namespace:
PHP

Client construction

The API key is now required in the Configuration constructor. Configuration::getDefaultConfiguration() and setDefaultConfiguration() have been removed. The FingerprintApi constructor also takes the configuration as its first argument, with the optional HTTP client second.
PHP

Get an event

The getEvent parameter $request_id is now $event_id, and the method returns an Event instead of a list($event, $response) tuple. The event data structure is flatter: fields are accessed directly instead of through the products wrapper.
PHP
If you need the raw HTTP response, use the WithHttpInfo variant. Every operation now exposes {operation}(), {operation}WithHttpInfo(), {operation}Async(), and {operation}AsyncWithHttpInfo() methods.
PHP

Search events

searchEvents now returns an EventSearch object instead of an array.
PHP

getVisits and getRelatedVisitors replaced by searchEvents

getVisits and getRelatedVisitors have been removed. Use searchEvents with the visitor_id to find the events for a particular visitor.
PHP

Update an event

updateEvent now takes the event ID first and an EventUpdate body second, returns void instead of an array, and issues a PATCH request instead of PUT.
PHP

Handling sealed client results from a v3 JavaScript agent

PHP SDK v7 will fail to deserialize the decrypted payload of a sealed client result sent by a v3 JavaScript agent into an Event because the payload is an EventsGetResponse (i.e., the v3 event format), not an Event. In this case, Sealed::unsealEventResponse throws an InvalidSealedDataException. To upgrade to PHP SDK v7 without requiring a concurrent upgrade to the v4 JavaScript agent, you can fall back to using the Server API if unsealing the sealed client results fails. To enable this fallback path, your frontend must send the event ID alongside the sealed client results, as recommended by the sealed client results guide. Both Sealed::unsealEventResponse and $client->getEvent return an Event, so the fallback returns the same type.
PHP

Documentation

You can find the full documentation in the official GitHub repository.