academe/particle
Composer 安装命令:
composer require academe/particle
包简介
A PSR-7 PHP package for working with the Particle API
README 文档
README
PHP package for interacting with the Particle Cloud, and its cloud-connected devices (Photon, P0, P1, Electron)
TODO
Work in progress, but main tasks are:
- Create tests.
-
Remove old Spark code. -
Replace examples. - Maybe remove the debug logging, given we have enough injected points to set debug.
- Full coverage of the API. Authentication as an application plus orgs are the main areas left.
Quick Installation
Using composer:
composer.phar require academe/particle
Add dependencies for the demo:
composer.phar require guzzlehttp/guzzle
Example Class
All the examples have been put into the Academe\Particle\Example class.
Please look into this class to see how the API works.
In summary, this package generates PSR-7 messages, which are sent using any suitable HTTP client.
At the moment there is no interpretation of the results - you need to get the results you need from the PSR-7 response, the format of which is documented in the Particle API documentation.
You can be run the examples like this:
use Academe\Particle\Example; $accessToken = 'your-account-access-token'; $deviceId = 'your-device-id'; $email = 'your-cloud-email-username'; $password = 'your-cloud-password'; // Instantiate the example class. $example = new Example($access_token, $device, $email, $password); // Flash the device with the Tinker application. $response = $example->flashTinker(); //$response = $example->setDeviceName(); //$response = $example->setDeviceName('christmas_turkey'); //$response = $example->listDevices(); //$response = $example->getDevice(); //$response = $example->getDevice('20033307343c03805403a138'); //$response = $example->newAccessToken(); //$response = $example->listTokens(); //$response = $example->deleteAccessToken('176a67f0d31647beac429252af8663a5040a945c'); //$response = $example->callFunction(); //$response = $example->listOranizations(); //$response = $example->removeMember('my_organization', 'someone@example.com'); echo "Status=" . $response->getStatusCode() . "\n"; echo "Reason=" . $response->getReasonPhrase() . "\n"; echo "Detail=" . $response->getBody() . "\n";
Don't forget to install Guzzle (v6) to run these examples:
composer require guzzlehttp/guzzle
Most of the other examples in this class require the Tinker application to be installed as the first step.
Implemented Features
TODO: this list is not complete. Some additional features are implemented, and the API has further new features that are not yet implemented.
Device Management
- List Devices
- Get device info
- Rename/Set device name
- Call Particle Function on a device
- Grab the value of a Particle Variable from a device
- Remote (Over the Air) Firmware Uploads
- Device signaling (make it flash a rainbow of colors)
Access Token Management
- Generate a new access token
- List your access tokens
- Delete an access token
Webhook Management
- List Webhooks
- Add Webhook
- Delete Webhook
Account/Cloud Management
- Use a local particle cloud
- Claim core or photon
- Remove core or photon
Not Yet Implemented Features
- OAuth Client Creation (/v1/clients)
- Advanced OAuth topics
academe/particle 适用场景与选型建议
academe/particle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 250 次下载、GitHub Stars 达 4, 最近一次更新时间为 2016 年 01 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「spark」 「iot」 「photon」 「particle」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 academe/particle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 academe/particle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 academe/particle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A plugin framework for Craft CMS
Client library for connecting to SignalWire.
A Spark command for CodeIgniter 4 that generates a modular structure for the ci4ms framework, including controllers, views, routes, and language files.
Create user notifications from your kiosk
Alfabank REST API integration
huawei dianxin iot SDK
统计信息
- 总下载量: 250
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-01-18