phlak/lifx-client
Composer 安装命令:
composer require phlak/lifx-client
包简介
PHP client library for the LIFX API (v1)
README 文档
README
PHP client library for the LIFX API (v1) -- by, Chris Kankiewicz (@PHLAK)
Introduction
LIFX Client is a LIFX API client library for PHP built with GuzzleHttp.
Refer to the full LIFX API documentation for more information about each method and it's available parameters.
Requirements
- PHP >= 7.1
Install with Composer
composer require phlak/lifx-client
Initializing the Client
First, import LIFX:
use PHLAK\LIFX;
Then instantiate the class with your LIFX OAuth 2 access token. You can generate an access token from your account settings page:
$lifx = new LIFX\Client('YOUR_APP_TOKEN');
Usage
List one or more lights via a selector:
$lifx->listLights($selector = 'all');
Set the state of one or more lights via a selector:
$lifx->setState($selector, array $params);
Set multiple states across multiple selectors:
$lifx->setStates(array $states, array $defaults = []);
Toggle the power of one or more lights via a selector:
$lifx->togglePower($selector, $duration = 1);
Cause one or more lights to breathe via a selector:
$lifx->breatheEffect($selector, $color, array $params = []);
Cause one or more lights to pulse via a selector:
$lifx->pulseEffect($selector, $color, array $params = []);
Make the light(s) cycle to the next or previous state in a list of states:
$lifx->cycle($selector, array $states, array $params = []);
Get a list of available scenes:
$lifx->listScenes();
Activate a scene:
$lifx->activateScene($sceneUuid, $duration = 1.0);
Validate a color string:
$lifx->validateColor($string);
Handling Exceptions
use GuzzleHttp\Exception\ClientException; try { $lifx->togglePower('id:123456789abcd'); } catch (ClientException $exception) { // Handle this exception here... }
See the GuzzleHttp exceptions documentation for more details.
Changelog
A list of changes can be found on the GitHub Releases page.
Troubleshooting
For general help and support join our [Spectrum Community](https://spectrum.chat/phlaknet or reach out on Twitter.
Please report bugs to the GitHub Issue Tracker.
Copyright
This project is licensed under the MIT License.
phlak/lifx-client 适用场景与选型建议
phlak/lifx-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.24k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2017 年 02 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 phlak/lifx-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phlak/lifx-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7.24k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-23
