henzeb/event-horizon
Composer 安装命令:
composer require henzeb/event-horizon
包简介
Enables seamless job monitoring and tag management across multiple Redis connections or databases
关键字:
README 文档
README
Event Horizon fixes Laravel Horizon's job monitoring when you have multiple Redis connections. It makes sure job tracking data goes to the right place - where the job is actually processed, not where it was pushed from.
The Problem
Horizon gets confused when you use multiple Redis connections. Here's what happens:
You push a job from connection A, but it gets processed on connection B. Horizon shows the job as "pending" on connection A's dashboard, even though it's actually running on connection B. This makes your dashboards misleading and makes it hard to see what's really happening with your jobs.
This becomes a real headache when you're trying to monitor job performance, debug issues, or just understand what's going on in your application. You end up checking multiple dashboards, seeing conflicting information, and never getting a clear picture of your job processing.
The root cause is that Horizon was built assuming you'd use one Redis connection for everything. When you have multiple connections (which is pretty common in modern apps), its monitoring system doesn't know how to handle jobs that cross connection boundaries.
The Solution
Event Horizon fixes this by tracking jobs where they actually get processed. When you push a job to connection B, all the monitoring data (job status, tags, metrics) gets stored in connection B's Redis instance, not where you pushed it from.
This means your Horizon dashboards show the real picture - jobs appear where they're actually running, making it much easier to monitor what's happening. No more hunting across different dashboards or trying to piece together where your jobs really are.
The package works by extending Horizon's core monitoring classes to be connection-aware. It automatically detects which Redis connection a job is destined for and routes all monitoring data there. You don't need to change any of your existing code - it just works.
Installation
composer require henzeb/event-horizon
That's it! Works automatically once installed.
When You Need This
- Multiple Redis connections: Your app uses different Redis instances for different purposes
- Multi-tenant applications: Each tenant has their own Redis instance and you want isolated monitoring
- Microservices: Different services push jobs to different connections
- Load balancing: You're spreading jobs across multiple Redis instances
- Team separation: Different teams manage different queue connections and want their own dashboards
Example
// Configure different connections for different purposes config([ 'queue.connections.web' => ['connection' => 'redis_web'], 'queue.connections.reports' => ['connection' => 'redis_reports'], 'queue.connections.exports' => ['connection' => 'redis_exports'], ]); // Jobs show up on the right dashboard where they're processed Queue::connection('web')->push(new ProcessOrder($order)); // Appears on web dashboard Queue::connection('reports')->push(new GenerateReport($data)); // Appears on reports dashboard Queue::connection('exports')->push(new ExportData($params)); // Appears on exports dashboard
Before Event Horizon, all these jobs might show up on the wrong dashboards depending on where you pushed them from. After installing it, each job appears exactly where you'd expect - on the dashboard for the connection that's actually processing it.
How It Works
Event Horizon extends three key parts of Horizon:
- Job monitoring: Tracks jobs in the correct Redis instance
- Tag storage: Stores job tags where the job is processed
- Event handling: Ensures monitoring events go to the right place
The package automatically replaces Horizon's default behavior with connection-aware versions. Everything happens behind the scenes - you don't need to change your existing job code or queue configuration.
Requirements
- PHP 8.2+
- Laravel Horizon ^5.0
- All Horizon instances must use the same
horizon.prefixconfiguration value
License
MIT License. See LICENSE.md for details.
henzeb/event-horizon 适用场景与选型建议
henzeb/event-horizon 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「redis」 「queue」 「monitoring」 「laravel」 「dashboard」 「jobs」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 henzeb/event-horizon 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 henzeb/event-horizon 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 henzeb/event-horizon 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for chameleon-system/sanitycheck
Microservice RPC through message queues.
PHP AMQP Binding Library
A Laravel package to monitor queue jobs.
The CodeIgniter Redis package
SoftWax Health Check Bundle for Symfony framework
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-10