- How do I install and set up the Laravel Govee package for my project?
- Run `composer require chipneedham/laravel-govee`, then publish the config with `php artisan vendor:publish --tag=config`. Add your Govee API key to `.env` under `GOVEE_API_KEY`. Ensure your Laravel version is 10.x and PHP is 8.1+.
- Which Laravel versions and PHP versions are supported by this package?
- The package supports Laravel 10.x and PHP 8.1+. It is not officially tested on Laravel 8.x or 9.x, though it may work with minor adjustments. Always check the package’s release notes for updates.
- Can I control Govee devices using Bluetooth instead of the cloud API?
- The current version primarily supports the Govee cloud API. Bluetooth functionality may require additional PHP extensions or system-level tools (e.g., `php-bluetooth` or `bluepy`). Check the package docs for updates on local device support.
- How do I handle Govee’s strict rate limits (e.g., 10 requests per minute) in my Laravel app?
- The package respects Govee’s rate limits by default. For production, implement retries with exponential backoff using Laravel’s `retry` helper or a package like Spatie’s Circuit Breaker. Cache frequent requests to minimize API calls.
- Is there a way to mock Govee API responses for testing in Laravel?
- Yes, you can mock the Govee facade using Laravel’s `MockFacade` or interfaces. Override the `Govee` facade binding in your tests to return mock responses. This is useful for unit and integration testing without hitting real Govee APIs.
- How do I securely store my Govee API key in Laravel?
- Store your `GOVEE_API_KEY` in Laravel’s `.env` file, which is excluded from version control. For added security, use Laravel’s `env()` helper or a secrets manager like AWS Secrets Manager or HashiCorp Vault for production deployments.
- Does this package support event listeners for Govee device changes (e.g., power state updates)?
- The package does not include built-in event listeners, but you can extend it by emitting custom events (e.g., `GoveeDeviceUpdated`) after API calls. Listen for these events in your Laravel app to trigger actions like notifications or database updates.
- What happens if the Govee API is down or unresponsive in production?
- The package throws exceptions on API failures. Implement a fallback strategy like caching the last known device state or using a local queue to retry failed requests. Consider adding a circuit breaker to prevent cascading failures.
- Are there alternatives to this package for controlling Govee devices in Laravel?
- For Govee-specific control, this is the most Laravel-native option. Alternatively, you could use a generic HTTP client like Guzzle to interact with the Govee API directly, but you’d lose the convenience of the facade and built-in helpers.
- How do I contribute to the Laravel Govee package or report bugs?
- Contributions are welcome! Submit pull requests or issues on the [GitHub repository](https://github.com/chipneedham/laravel-govee). Follow the project’s contributing guidelines, and ensure your changes include tests and documentation updates.