chipneedham/laravel-govee
Composer 安装命令:
composer require chipneedham/laravel-govee
包简介
integrating Govee with Laravel
README 文档
README
A Laravel package for interacting with the Govee Smart Home API, allowing easy control and management of Govee smart devices. At the moment only lights are supported.
Installation
You can install the package via Composer:
composer require chipneedham/laravel-govee
Configuration
Publish the configuration file:
php artisan vendor:publish --tag="config"
This will create a config/govee.php file. Add your Govee API key to your .env file:
GOVEE_API_KEY=your_govee_api_key_here
Getting an API key
Usage
Retrieving Devices
use Govee; // Get all Govee devices $devices = Govee::getDevices(); foreach ($devices as $device) { echo $device->name; // Device name echo $device->deviceId; // Device ID }
Device Control
// Turn a device on/off $device->setPowerState(true); // Turn on $device->setPowerState(false); // Turn off // Set brightness (1-100) $device->setBrightness(50); // Set color using RGB $device->setColor(255, 0, 0); // Red // Set color using Hex $device->setHexColor('#00FF00'); // Green // Set white color temperature (2000-9000K) $device->setWhiteTemperature(4000);
Directly Accessing a Device
// If you know the device ID and model $specificDevice = Govee::getDevice('your-device-id', 'your-device-model');
Rate Limits
Govee's rate limits are annoyingly low. Sorry.
| Endpoint | Limit |
|---|---|
| DeviceList | 10 per minute |
| DeviceControl | 10 per minute per device |
| DeviceState | 10 per minute per device |
| Total Requests | 10000 per day |
Error Handling
Error handling has a lot of work to be done, at the moment be sure to use trys. The package throws exceptions for invalid inputs or API errors:
try { $device->setBrightness(150); // Will throw an exception } catch (\Exception $e) { // Handle error echo $e->getMessage(); }
Facade
The package includes a Govee facade for easy access to the Govee API client.
Requirements
- PHP 8.1+
- Laravel 10.x+
- Govee API Key
Security
Please ensure your Govee API key is kept secure and not committed to version control.
Contributing
Contributions are welcome! Please submit pull requests or file issues on the GitHub repository.
Support
If you encounter any issues or have questions, please file an issue on the GitHub repository.
chipneedham/laravel-govee 适用场景与选型建议
chipneedham/laravel-govee 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 chipneedham/laravel-govee 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chipneedham/laravel-govee 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-27