定制 pjanisio/ewelink-api-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pjanisio/ewelink-api-php

最新稳定版本:v3.2.0

Composer 安装命令:

composer require pjanisio/ewelink-api-php

包简介

API connector for Sonoff/eWeLink devices

README 文档

README

Packagist PHP >= 7.4 CI License

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

📦 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)

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

Full examples live in the Wiki.

✅ Features

Area What 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

Need an out‑of‑the‑box dashboard? Check the companion project ewelinkapiphp‑device‑monitoring – asynchronous UI, HTTP + WS under the hood.

Monitoring screenshot

🗂 Documentation

  • Getting started / API reference → see the Wiki Pages
  • Developer notes (architecture, contribution guide) → Developers Wiki

⚙️ Requirements

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

📝 License

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

🔗 Integrations & Use Cases

统计信息

  • 总下载量: 256
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 3
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-08