PHP code example of pjanisio / ewelink-api-php
1. Go to this page and download the library: Download pjanisio/ewelink-api-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pjanisio / ewelink-api-php example snippets
pjanisio\ewelinkapiphp\Constants;
use pjanisio\ewelinkapiphp\HttpClient;
$http = new HttpClient(); // takes creds from constants / env
$token = $http->getToken(); // OAuth flow (auto‑refreshes)
$devices = $http->getDevices(); // Devices façade
$list = $devices->getDevicesList();
print_r($list); // see everything at once
$lampId = '100xxxxxx';
$devices->setDeviceStatus($lampId, ['switch' => 'on']); // turn it on
bash
composer