承接 loft-digital/phikettle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

loft-digital/phikettle

最新稳定版本:1.1.0

Composer 安装命令:

composer require loft-digital/phikettle

包简介

README 文档

README

Build Status

PhiKettle is a PHP API which allows you to control your iKettle. The library provides basic functionality for kettle control and response handling. It's built on top of the reactphp library.

A write up of the Kettle protocol: http://www.awe.com/mark/blog/20140223.html

Installation

Using Composer:

composer require loft-digital/phikettle

Kettle IP address discovery

The Kettle can be discovered on your local network using Nmap, default kettle port number and local IP range:

nmap -p 2000 --open 192.168.3.0/24

It can also be discovered with IP scanner script using kettle discovery request: \PhiKettle\Config::D_REQUEST. The Kettle will respond with \PhiKettle\Config::D_RESPONSE message.

Example usage

Basic kettle listener

Example file: basic-listener.php

A Kettle object is created using the kettle's local IP address and default port of 2000. After that, the status request message is sent to a kettle stream and a response from the kettle is subsequently handled in a stream listener.

Run listener:

$ php ./examples/basic-listener.php

Kettle socket server

Example file: socket-server.php

A Socket server is created on a localhost and is listening on port 1336. It accepts 2 commands: boil and off. After a command is run, the kettle action is triggered and response is handled in kettle stream listener.

Run socket server:

$ php ./examples/socket-server.php

Run client:

$ telnet localhost 1336
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Kettle commands:
- boil
- off

Enter your command and press Enter:

boil
=> Kettle was boiled

off
=> Kettle was turned off

Contributing

Contributions, suggestions and fixes are more than welcome.

General contribution guidelines apply:

  1. Fork the repository
  2. Create a feature/hotfix branch off of master
  3. Run PHPUnit tests ($ ./vendor/bin/phpunit)
  4. Commit and push the branch
  5. Make a pull request
  6. If you're unsure on whether your contribution will be required then please file an issue first and we can discuss it.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 4
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-10-19