定制 phlak/lifx-client 二次开发

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

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

phlak/lifx-client

Composer 安装命令:

composer require phlak/lifx-client

包简介

PHP client library for the LIFX API (v1)

README 文档

README

LIFX Client

Join our Community Become a Sponsor One-time Donation
Latest Stable Version Total Downloads License Build Status StyleCI

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

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.

统计信息

  • 总下载量: 7.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固