定制 webproject-xyz/ikea-tradfri-php-api 二次开发

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

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

webproject-xyz/ikea-tradfri-php-api

Composer 安装命令:

composer require webproject-xyz/ikea-tradfri-php-api

包简介

PHP library to control ikea tradfri hub

README 文档

README

Codacy Badge QA Codacy Badge codecov Release PHP Version Latest Stable Version Total Downloads License

A powerful PHP library to control IKEA Tradfri smart lights via the Gateway.

🚀 Quick Start

1. Requirements

  • PHP 8.4+
  • coap-client (available via Docker)

2. Generate Security Key

Use the Docker Coap-Client to get your credentials:

docker run --rm webproject/coap-client 
  -m post -u "Client_identity" -k "<GATEWAY_SECRET>" 
  -e '{"9090":"php-api-user"}' 
  "coaps://<GATEWAY_IP>:5684/15011/9063"

💻 Usage

Initialize API

use IKEA\Tradfri\Dto\CoapGatewayAuthConfigDto;
use IKEA\Tradfri\Factory\GatewayServiceFactory;

$api = (new GatewayServiceFactory(
    new CoapGatewayAuthConfigDto(
        username: 'php-api-user',
        apiKey: 'GENERATED_API_KEY',
        gatewayIp: '192.168.1.10',
        gatewaySecret: 'GATEWAY_SECRET'
    )
))();

Control Devices

// Switch on all lights and dim to 80%
foreach ($api->getLights() as $light) {
    $light->switchOn()->dim(80);
}

// Switch off a specific group
$api->getGroups()->first()?->switchOff();

📖 Documentation

🤝 Contributing

Feel free to submit Pull Requests.

📄 License

MIT License.

统计信息

  • 总下载量: 46
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固