Laravel Pennant is a lightweight feature flag package designed to enable incremental rollout and management of application features with ease. It supports multiple storage drivers, including an in-memory array, a database, and custom drivers such as Redis[2]. Laravel Horizon, on the other hand, is a dashboard and monitoring tool specifically for Laravel's Redis queues, providing real-time insights into queue processing and job status[1][4].
Regarding the use of Laravel Pennant with Laravel Horizon for real-time feature flagging, there is no direct integration or built-in connection between the two packages. Laravel Horizon focuses on queue monitoring and management, while Pennant handles feature flags and their evaluation logic. However, you can architect a solution that leverages both:
- Custom Pennant Driver Using Redis: Pennant allows the creation of custom feature flag drivers, including one that can use Redis as the backend store. You can implement a Redis-based feature flag driver for Pennant, which can store and update feature flags in Redis. This approach can facilitate real-time updates and low-latency flag checks[2].
- Queue Jobs and Horizon Monitoring: If your application updates feature flags asynchronously (for example, via queued jobs that modify flags in Redis), Laravel Horizon can monitor those jobs in real-time. This setup allows you to track the processes that change feature flags but does not provide a direct feature flag management interface.
- Events and Metrics: Pennant dispatches events when features are checked or resolved, which you could listen to and potentially push metrics or notifications through Laravel's event system. While Horizon does not natively display feature flag metrics, you could build custom dashboards or monitoring tools that aggregate these events alongside Horizon's queue monitoring[2].
- No Dashboard for Feature Flags in Horizon: As of now, there is no official or community-built Horizon dashboard for managing or visualizing Laravel Pennant feature flags. Discussions in the community indicate interest in such a tool, but it does not exist yet[3].
In summary, Laravel Pennant can be used alongside Laravel Horizon in a Laravel application, but they serve different purposes. Pennant manages feature flags, potentially with a Redis backend for real-time performance, while Horizon monitors Redis queues and jobs. Real-time feature flagging with Pennant can be achieved by using Redis as a backend and leveraging Laravel's event system, but Horizon itself does not provide feature flag management or visualization capabilities.
Thus, while you can use both in the same application and even have them interact indirectly via Redis and queues, Laravel Pennant and Laravel Horizon are not integrated out of the box for real-time feature flagging[1][2][3][4].
Citations:
[1] https://laravel.com/docs/11.x/horizon
[2] https://laravel.com/docs/12.x/pennant
[3] https://www.reddit.com/r/laravel/comments/13htk4p/laravel_pennant_management/
[4] https://www.youtube.com/watch?v=r3c_qBvAHXA
[5] https://laravel-news.com/feature-flags-with-laravel-pennant
[6] https://www.honeybadger.io/blog/a-guide-to-feature-flags-in-laravel/
[7] https://wpwebinfotech.com/blog/laravel-pennant-guide/
[8] https://dev.to/saurabh-dhariwal/how-to-manage-feature-flags-with-laravel-pennant-in-2024-1phb