Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
PHP
Branch: master

Update Error.php

Add empty checks in Error.php
latest commit 56fa5d5175
@jaesga jaesga authored

README.md

LATCH PHP SDK

 PREREQUISITES

USING THE SDK IN PHP

  • Require "latch" sdk. Keep in mind to set the path properly according to your server.
    require_once("latch/Latch.php");
     require_once("latch/LatchResponse.php");
     require_once("latch/Error.php");
  • Create a Latch object with the "Application ID" and "Secret" previously obtained.
    $api = new Latch(APP_ID, APP_SECRET);
  • Optional settings:
    $api->setProxy(YOUR_PROXY);
  • Call to Latch Server. Pairing will return an account id that you should store for future api calls
     $pairResponse = $api->pair("PAIRING_CODE_HERE");
     $statusResponse = $api->status(ACCOUNT_ID_HERE);
     $unpairResponse = $api->unpair(ACCOUNT_ID_HERE);
  • After every API call, get Latch response data and errors and handle them.
     $pairResponse->getData();
     $pairResponse->getError();
Something went wrong with that request. Please try again.