https://github.com/telefonica/latch-sdk-php
https://github.com/telefonica/latch-sdk-php
dir-cto org-cdo public srv-latch srv-livingapps
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/telefonica/latch-sdk-php
- Owner: Telefonica
- License: lgpl-2.1
- Created: 2013-12-10T19:13:04.000Z (almost 12 years ago)
- Default Branch: main
- Last Pushed: 2025-01-24T08:22:49.000Z (9 months ago)
- Last Synced: 2025-04-13T05:07:44.832Z (6 months ago)
- Topics: dir-cto, org-cdo, public, srv-latch, srv-livingapps
- Language: PHP
- Homepage:
- Size: 92.8 KB
- Stars: 17
- Watchers: 12
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
### LATCH PHP SDK ###
#### PREREQUISITES ####
* PHP 8.2 or above.
* Read API documentation (https://latch.tu.com/www/developers/doc_api).
* To get the "Application ID" and "Secret", (fundamental values for integrating Latch in any application), it’s necessary to register a developer account in Latch's website: https://latch.tu.com. On the upper right side, click on "Login".
#### 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();
```