fingerprintjs/php-sdk
GitHub: fingerprintjs/php-sdk
Fingerprint Pro 服务端 API 的官方 PHP SDK,封装了事件查询、搜索、更新、访客数据删除、密封结果解密和 Webhook 签名验证等功能。
Stars: 32 | Forks: 7
# Fingerprint 服务端 PHP SDK
**Fingerprint 服务端 API 允许您在服务端环境中获取、搜索和更新 Events。它可用于数据导出、决策和数据分析等场景。服务端 API 专供服务端使用,不适用于客户端(无论是浏览器还是移动设备)。**
此 PHP 包由 [OpenAPI Generator](https://openapi-generator.tech) 项目自动生成:
- API 版本: 4
- 包版本: 7.1.0
- 构建包: org.openapitools.codegen.languages.PhpClientCodegen
## 环境要求
此库支持以下 PHP 实现:
- PHP 8.2
- PHP 8.3
- PHP 8.4
我们目前不支持以下外部 PHP Runtime:
- Bref
- ReactPHP
## 安装与使用
### Composer
要通过 [Composer](https://getcomposer.org/) 安装绑定,请将以下内容添加到 `composer.json` 中:
```
{
"require": {
"fingerprint/server-sdk": "^7.1.0"
}
}
```
然后运行 `composer install`。
或者您可以直接在终端中运行以下命令:
`composer require fingerprint/server-sdk`
## 快速入门
请按照[安装步骤](#installation--usage)操作,然后运行以下代码:
```
getEventWithHttpInfo(FP_EVENT_ID);
echo "
" . $response->getBody()->getContents() . ""; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->getEventWithHttpInfo: ', $e->getMessage(), PHP_EOL; } // Search for specific events try { // Search events for given visitor id marked as suspicious and "bad" bot list($model, $response) = $client->searchEventsWithHttpInfo(LIMIT, visitor_id: FP_VISITOR_ID, bot: SearchEventsBot::BAD, suspect: true); // Use pagination key to get the next page // list($model, $response) = $client->searchEventsWithHttpInfo(LIMIT, pagination_key: $model->getPaginationKey(), visitor_id: FP_VISITOR_ID, bot: SearchEventsBot::BAD, suspect: true); echo "
" . $response->getBody()->getContents() . ""; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->searchEventsWithHttpInfo: ', $e->getMessage(), PHP_EOL; } // Update Event try { $body = new EventUpdate([ 'linked_id' => 'new linked id', 'tags' => ['new_property' => 'new value'], 'suspect' => true, ]); list($model, $response) = $client->updateEventWithHttpInfo($body, FP_EVENT_ID); echo "
" . $response->getBody()->getContents() . ""; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->updateEventWithHttpInfo: ', $e->getMessage(), PHP_EOL; } // Delete by visitor ID try { list($model, $response) = $client->deleteVisitorDataWithHttpInfo(FP_VISITOR_ID); echo "
" . $response->getBody()->getContents() . ""; } catch (Exception $e) { echo 'Exception when calling FingerprintApi->deleteVisitorDataWithHttpInfo: ', $e->getMessage(), PHP_EOL; } ``` ## 密封结果 此 SDK 提供了解码[密封结果](https://docs.fingerprint.com/docs/sealed-client-results)的实用方法。 ``` getMessage())); exit(1); } ``` 要了解更多信息,请参阅 [sealed_results_example.php](sealed_results_example.php) 中的示例。 ## API 端点文档 所有 URI 均相对于您所在区域的基础 URL。 | 区域 | BasePath | |-------------|---------------------------| | 美国 / 全球 | https://api.fpjs.io/v4 | | 欧洲 | https://eu.api.fpjs.io/v4 | | 亚洲 | https://ap.api.fpjs.io/v4 | ## Webhook 签名 此 SDK 提供了验证传入 webhook 请求 HMAC 签名的实用方法。 您可以使用以下代码来验证签名: ```
标签:Bot检测, ffuf, Fingerprint Pro, OpenVAS, Packagist, PHP, 反欺诈, 开源, 服务端API, 浏览器指纹, 用户追踪, 设备识别