redcomercio/latch-sdk-php

dev-main 2024-07-22 22:26 UTC

This package is not auto-updated.

Last update: 2024-10-01 21:28:18 UTC


README

LATCH PHP SDK

 先决条件

在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();