fingerprintjs / fingerprint-pro-server-api-php-sdk

PHP SDK for Fingerprint Pro Server API
MIT License
19 stars 5 forks source link
audio-fingerprinting browser browser-fingerprint browser-fingerprinting detection fingerprint fingerprinting fingerprintjs fingerprintjs-pro fraud fraud-detection identification php visitor-identification

Fingerprint logo

CI badge CI badge Unit Test Coverage CI badge Latest Stable Version on Packagist PHP Version Require Discord server

# Fingerprint Pro Server API PHP SDK **Fingerprint Pro Server API allows you to get information about visitors and about individual events in a server environment. It can be used for data exports, decision-making, and data analysis scenarios. Server API is intended for server-side usage, it's not intended to be used from the client side, whether it's a browser or a mobile device.** This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 3 - Package version: 5.0.0 - Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen ## Requirements This library supports the following PHP implementations: - PHP 8.1 - PHP 8.2 - PHP 8.3 We currently don't support external PHP Runtimes like: - Bref - ReactPHP ## Installation & Usage ### Composer To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: ``` { "require": { "fingerprint/fingerprint-pro-server-api-sdk": "dev-main" } } ``` Then run `composer install`. Or you can just run this command on your terminal: `composer require fingerprint/fingerprint-pro-server-api-sdk` ## Getting Started Please follow the [installation procedure](#installation--usage) and then run the following: ```php getEvent(FPJS_REQUEST_ID); echo "
" . $response->__toString() . "
"; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->getEvent: ', $e->getMessage(), PHP_EOL; } // Get a specific visitor's all visits try { // Fetch all visits with a given visitorId, with a page limit list($model, $response) = $client->getVisits(FPJS_VISITOR_ID, null, null, LIMIT); echo "
" . $response->__toString() . "
"; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->getVisits: ', $e->getMessage(), PHP_EOL; } // Get a specific visitor's all visits with a linkedId try { // Fetch all visits with a given visitorId, with a page limit, skipping the first visit list($model, $response) = $client->getVisits(FPJS_VISITOR_ID, null, FPJS_LINKED_ID, LIMIT, PAGINATION_KEY); echo "
" . $response->__toString() . "
"; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->getVisits: ', $e->getMessage(), PHP_EOL; } // Use all the parameters on getVisits try { // Fetch the visitor's all visits with a given requestId and linkedId with a page limit while skipping the first visit list($model, $response) = $client->getVisits(FPJS_VISITOR_ID, FPJS_REQUEST_ID, FPJS_LINKED_ID, LIMIT, PAGINATION_KEY); echo "
" . $response->__toString() . "
"; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->getVisits: ', $e->getMessage(), PHP_EOL; } // Update Event try { $body = new EventUpdateRequest([ 'linked_id' => 'new linked id', 'tag' => json_encode(['new_property' => 'new value']), 'suspect' => true, ]); list($model, $response) = $client->updateEvent($body, FPJS_REQUEST_ID); echo "
" . $response->__toString() . "
"; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->updateEvent: ', $e->getMessage(), PHP_EOL; } // Delete by visitor ID try { list($model, $response) = $client->deleteVisitorData(FPJS_VISITOR_ID); echo "
" . $response->__toString() . "
"; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->deleteVisitorData: ', $e->getMessage(), PHP_EOL; } ``` > ⚠️ Warning It's not possible to update events older than 10 days. > ⚠️ If you are interested in using `deleteVisitorData` API, please [contact our support team](https://fingerprint.com/support/) to enable it for you. Otherwise, you will receive a 403. ## Sealed results This SDK provides utility methods for decoding [sealed results](https://dev.fingerprint.com/docs/sealed-client-results). ```php getMessage())); exit(1); } ``` To learn more, refer to example located in [sealed_results_example.php](sealed_results_example.php). ## Documentation for API Endpoints All URIs are relative to your region's base URL. | Region | BasePath | |-------------|------------------------| | US / Global | https://api.fpjs.io | | Europe | https://eu.api.fpjs.io | | Asia | https://ap.api.fpjs.io | ## Webhook Signing This SDK provides utility method for verifying the HMAC signature of the incoming webhook request. You can use below code to verify signature: ```php