elevenpaths / latch-sdk-php
此包尚未发布版本,信息有限。
README
LATCH PHP SDK
#### PREREQUISITES ####
-
PHP 5.3 或更高版本。
-
阅读API文档(https://latch.elevenpaths.com/www/developers/doc_api)。
-
要获取“应用程序ID”和“密钥”(在任何应用程序中集成LATCH的基本值),需要在LATCH网站上注册开发者账户:https://latch.elevenpaths.com。在上右角点击“开发者区域”。
在PHP中使用SDK
- 使用composer要求“latch” SDK
composer require elevenpaths/latch-sdk-php
- 使用之前获取的“应用程序ID”和“密钥”创建一个Latch对象。
$api = new Latch(APP_ID, APP_SECRET);
- 可选设置
$api->setProxy(YOUR_PROXY);
- 调用Latch服务器。配对将返回一个账户ID,您应该将其存储以供将来API调用使用。
$pairResponse = $api->pair("PAIRING_CODE_HERE");
$statusResponse = $api->status(ACCOUNT_ID_HERE);
$unpairResponse = $api->unpair(ACCOUNT_ID_HERE);
- 每次API调用后,获取Latch响应数据和错误并处理它们。
$pairResponse->getData();
$pairResponse->getError();