PHPackages                             dwedaz/tuya-api-wrapper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. dwedaz/tuya-api-wrapper

ActiveLibrary[API Development](/categories/api)

dwedaz/tuya-api-wrapper
=======================

v1.0.0(5y ago)026PHP

Since Jan 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/dwedaz/tuya-api-wrapper)[ Packagist](https://packagist.org/packages/dwedaz/tuya-api-wrapper)[ RSS](/packages/dwedaz-tuya-api-wrapper/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Tuya API Wrapper for PHP
========================

[](#tuya-api-wrapper-for-php)

 Reference DocsTuya opens up a variety of APIs covering business scenarios such as device pairing, smart home management, device control, and scene automation

These client libraries are not officially supported by tuya. However, the libraries are considered work and are in maintenance mode. This means that we will address critical bugs and security issues, for the feature use will add some new features.

Installation
------------

[](#installation)

You can use **Composer** or simply **Download the Release**

### Composer

[](#composer)

The preferred method is via [composer](https://getcomposer.org/). Follow the [installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have composer installed.

Once composer is installed, execute the following command in your project root to install this library:

```
composer require dwedaz/tuya-api-wrapper:"1.0"
```

Finally, be sure to include the autoloader:

```
require_once '/path/to/your-project/vendor/autoload.php';
```

Requirements
============

[](#requirements)

- [PHP 7.2.5 or higher](https://www.php.net/)

### Basic Example

[](#basic-example)

```
require 'vendor/autoload.php';
use Dwedaz\TuyaApiWrapper\TuyaApi;

use Dwedaz\TuyaApiWrapper\AuthorizationManagement\GetToken;
use Dwedaz\TuyaApiWrapper\AuthorizationManagement\RefreshToken;
use Dwedaz\TuyaApiWrapper\DeviceControl\ControlDevice;
use Dwedaz\TuyaApiWrapper\DeviceControl\DeviceStatus;

$clientId = 'xxxxxxxxxxxxx';
$secret = 'xxxxxxxxxxxxx';
$deviceId = 'xxxxxxxxx';
$filename = 'token.json';

try{

    $client = new TuyaApi($clientId, $secret);
    if (!file_exists($filename)){
        $accessToken = json_decode(file_get_contents($filename), true);
        $token = $accessToken['result']['access_token'];
        $client->setAccessToken($token);
    }else{
        $accessToken = $client->call(GetToken::class, ['grant_type' => 1]);
        file_put_contents($filename, json_encode($accessToken));
    }
    print_r($client->call(DeviceStatus::class, $deviceId));
}catch (Exception $e){
    echo $e->getMessage();
}

```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1989d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c0512139472d1afbd08520b23bb1acf7aa85af79bcf5b111e2b1fe2b1a8c7ee6?d=identicon)[dwedaz](/maintainers/dwedaz)

---

Top Contributors

[![dwedaz](https://avatars.githubusercontent.com/u/1939059?v=4)](https://github.com/dwedaz "dwedaz (2 commits)")

### Embed Badge

![Health badge](/badges/dwedaz-tuya-api-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/dwedaz-tuya-api-wrapper/health.svg)](https://phpackages.com/packages/dwedaz-tuya-api-wrapper)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M981](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.5M7](/packages/avalara-avataxclient)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1943.1k5](/packages/aimeos-prisma)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
