PHPackages                             pjanisio/ewelink-api-php - 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. pjanisio/ewelink-api-php

ActiveLibrary

pjanisio/ewelink-api-php
========================

API connector for Sonoff/eWeLink devices

v3.2.0(9mo ago)133946[3 issues](https://github.com/PJanisio/ewelinkApiPhp/issues)MITPHPPHP &gt;=7.4CI passing

Since Jul 9Pushed 3mo ago4 watchersCompare

[ Source](https://github.com/PJanisio/ewelinkApiPhp)[ Packagist](https://packagist.org/packages/pjanisio/ewelink-api-php)[ Docs](https://github.com/PJanisio/ewelinkApiPhp)[ Fund](https://www.buymeacoffee.com/pjanisio)[ RSS](/packages/pjanisio-ewelink-api-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (6)Used By (0)

eWeLink API PHP – Connect to Sonoff / eWeLink devices
=====================================================

[](#ewelink-api-php--connect-to-sonoff--ewelink-devices)

[![Packagist](https://camo.githubusercontent.com/3236de29b3e5ace399d8b72d181dae17e7a0b1e5d4d3cfacefab335787805a0a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706a616e6973696f2f6577656c696e6b2d6170692d7068703f6c6f676f3d636f6d706f736572)](https://packagist.org/packages/pjanisio/ewelink-api-php)[![PHP >= 7.4](https://camo.githubusercontent.com/1cbfa182f0e8f03ae244c7777d9573a1e41092058c952d88e22c39edc0fe6463/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342532422d3737376262333f6c6f676f3d706870)](https://www.php.net/supported-versions.php)[![CI](https://github.com/PJanisio/ewelinkApiPhp/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/PJanisio/ewelinkApiPhp/actions/workflows/ci.yml)[![License](https://camo.githubusercontent.com/d3e062fdc65bba4b77f266d67dbbd6cc472639ab89f526e9d5d61e8a0be48a04/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f504a616e6973696f2f6577656c696e6b417069506870)](LICENSE)

`ewelink-api-php` lets you talk to your eWeLink–enabled devices (Sonoff, KingArt, etc.) **directly from PHP**. It wraps the official HTTP &amp; WebSocket endpoints, handles OAuth, and gives you a neat object‑oriented façade.

---

📦 Installation
--------------

[](#-installation)

```
composer require pjanisio/ewelink-api-php
```

Composer installs the library, creates `vendor/autoload.php`, and you’re ready to go.

---

🚀 Quick‑example (after authorization)
-------------------------------------

[](#-quickexample-after-authorization)

```
$lampId  = '100xxxxxx';
$devices->setDeviceStatus($lampId, ['switch' => 'on']);  // turn it on
```

Full examples live in the **[Wiki](https://github.com/PJanisio/ewelinkApiPhp/wiki)**.

---

✅ Features
----------

[](#-features)

AreaWhat you can do**Discovery**• Fetch *all* devices in one call
• Search by `deviceid` **or** human name
• Persist raw data as `devices.json`**Status**• Read any single or multi params live (`switch`, `voltage`, `power`, …)
• Grab *all* live params at once
• Check if a device is online**Control**• Set one or many params (HTTP)
• Multi‑channel helpers (`switches[n]`)
• WebSocket realtime control**Monitoring**• Live power metrics (voltage / current / power)
• Device history endpoint (`/v2/device/history`)**Maintenance**• Force wake‑up (handshake + echo params)**Dev tools**• PSR‑4 autoloading via Composer
• `DEBUG` mode – full request/response log to `debug.log`---

🖥️ Demo Monitoring App
----------------------

[](#️-demo-monitoring-app)

Need an out‑of‑the‑box dashboard? Check the companion project **[ewelinkapiphp‑device‑monitoring](https://github.com/PJanisio/ewelinkapiphp-device-monitoring)** – asynchronous UI, HTTP + WS under the hood.

[![Monitoring screenshot](https://private-user-images.githubusercontent.com/9625885/346008394-7658cbe6-cdb9-48bc-9f0d-1a2db4e67147.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiL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UFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDY3YTA2ODQxYWZlOTE0YTBlY2E4NjZiYTU2NDU4ZWUwMjgyM2I2MzUzOWU2MmNhMTM0NmE3YjcyNmU3NjVjMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.K36cznB9tRvB7T4HMc5rRlt9qzOMwYbiG7LH8sC7V0c)

---

🗂 Documentation
---------------

[](#-documentation)

- **Getting started / API reference →** see the [Wiki Pages](https://github.com/PJanisio/ewelinkApiPhp/wiki)
- **Developer notes** (architecture, contribution guide) → [Developers Wiki](https://github.com/PJanisio/ewelinkApiPhp/wiki/Developers)

---

⚙️ Requirements
---------------

[](#️-requirements)

- PHP **7.4 or newer**
- Extensions: `curl`, `json`, `openssl` ( enabled by default on typical PHP installs)

---

📝 License
---------

[](#-license)

MIT – do what you want, just keep the copyright notice.

---

🔗 Integrations &amp; Use Cases
------------------------------

[](#-integrations--use-cases)

- **Drupal eWeLink module** – integrate Sonoff devices into your Drupal site via [drupal.org/project/ewelink](https://www.drupal.org/project/ewelink)
- **Bee Hotel Reservation Access** – powers the Bee Hotel, see [Bee Hotel docs](https://www.drupal.org/docs/extending-drupal/contributed-modules/contributed-module-documentation/bee-hotel/11-reservation-access-by-beehotel)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance64

Regular maintenance activity

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.5% 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

Every ~11 days

Total

4

Last Release

278d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/69ad25a27df094fe0b3928a5a33a86f4c36e5801fe1c81827617f385a40105ac?d=identicon)[PJanisio](/maintainers/PJanisio)

---

Top Contributors

[![PJanisio](https://avatars.githubusercontent.com/u/9625885?v=4)](https://github.com/PJanisio "PJanisio (201 commits)")[![xbipin](https://avatars.githubusercontent.com/u/10514905?v=4)](https://github.com/xbipin "xbipin (1 commits)")

---

Tags

device-monitoringewelink-apiewelink-connector-apiewelink-php-apisonoff-apiiotsmarthomesonoffEWeLink

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pjanisio-ewelink-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/pjanisio-ewelink-api-php/health.svg)](https://phpackages.com/packages/pjanisio-ewelink-api-php)
```

###  Alternatives

[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35636.1k2](/packages/telnyx-telnyx-php)[signalwire-community/signalwire

Client library for connecting to SignalWire.

23126.2k](/packages/signalwire-community-signalwire)[oliverlorenz/php-mqtt-client

a mqtt client library for php

381.4k1](/packages/oliverlorenz-php-mqtt-client)

PHPackages © 2026

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