PHP code example of diogodourado / smartlife-control-php

1. Go to this page and download the library: Download diogodourado/smartlife-control-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/ */

    

diogodourado / smartlife-control-php example snippets


return [
    'accessId'     => 'SEU_ACCESS_ID',
    'accessSecret' => 'SEU_ACCESS_SECRET',
    'endpoint'     => 'https://openapi.tuyaus.com',
    'tokenFile'    => __DIR__ . '/smartlife_token.json',
    'userId'       => 'SEU_UID_TUYA',
];
bash
composer 

examples/config.php
bash
php examples/get_token.php
bash
php examples/list_devices.php

http://localhost:8000/toggle_device.php?deviceId=SEU_DEVICE_ID&on=1
http://localhost:8000/toggle_device.php?deviceId=SEU_DEVICE_ID&on=0

src/
  SmartlifeClient.php
  SmartlifeTokenStore.php

examples/
  config.php
  get_token.php
  list_devices.php
  toggle_device.php

README.md
composer.json
LICENSE