elyerr/horizon
Composer 安装命令:
composer require elyerr/horizon
包简介
Dashboard and code-driven configuration for Laravel queues with CSP support
README 文档
README
Introduction
Horizon provides a beautiful dashboard and code-driven configuration for your Laravel powered Redis queues. Horizon allows you to easily monitor key metrics of your queue system such as job throughput, runtime, and job failures.
All of your worker configuration is stored in a single, simple configuration file, allowing your configuration to stay in source control where your entire team can collaborate.
Official Documentation
Documentation for Horizon can be found on the Laravel website.
Homepage Route
You can configure a custom application homepage route through the Horizon configuration file.
This route is used by the Home button displayed in the Horizon interface, allowing users to quickly return to the main application dashboard.
'homepage' => 'home',
The value must be the name of a registered Laravel route.
Example:
'homepage' => 'dashboard',
If your application uses a custom dashboard or landing page, simply set the corresponding route name in the configuration.
✨ Content Security Policy (CSP) Support for Horizon
Laravel Horizon adds full Content Security Policy (CSP) compatibility, including automatic nonce generation and safe injection into all Horizon inline <script> and <style> tags.
Modern CSP configurations disallow inline scripts/styles unless they include a valid nonce. The original Horizon UI relied on multiple inline scripts, which made it incompatible with strict CSP setups.
Now the Horizon UI so it works correctly under:
script-src 'self' 'nonce-...'- strict
style-srcrules - browsers where
unsafe-inlineandunsafe-evalare forbidden - enterprise-grade security environments
📘 Content Security Policy (CSP) Support
Content Security Policy (CSP) is a security standard that helps protect web applications from XSS and content injection attacks. It works by defining which scripts, styles, and external resources are allowed to run.
This fork adds full, native CSP support to Laravel Horizon, allowing you to keep strong security rules without needing to weaken your policy.
🔧 How CSP Support Works
This version of Horizon automatically uses the CSP nonce you generate in your application and applies it to:
- inline
<script>tags - inline style attributes
- Horizon’s boot scripts
- required
<link>elements (such as fonts or preconnect)
The middleware in your app shares the nonce globally, making it available to all Blade views, including Horizon.
⚙️ Usage
- Generate a nonce on each request in a middleware.
- Share the nonce globally (e.g.,
view()->share('nonce', $nonce)). - Attach your CSP headers.
- Register the middleware in the web group.
Horizon will automatically detect the nonce and apply it internally.
📄 Example Middleware (Oauth2 Passport Server)
Your middleware implementation can be seen here:
SecureHeaders:
https://github.com/elyerr/oauth2-passport-server/blob/main/app/Http/Middleware/SecureHeaders.php
It handles:
- generating the nonce
- sharing the nonce globally
- applying CSP headers
- providing Horizon-specific CSP rules
📁 Kernel Registration
Laravel 10 and below
protected $middlewareGroups = [ 'web' => [ \App\Http\Middleware\SecureHeaders::class, // other middlewares... ], ];
Laravel 11+
$middleware->web( append: [ SecureHeaders::class, // other middlewares... ] );
Contributing
Thank you for considering contributing to Horizon! The contribution guide can be found in the Laravel documentation.
Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
License
Laravel Horizon is open-sourced software licensed under the MIT license.
elyerr/horizon 适用场景与选型建议
elyerr/horizon 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 305 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「queue」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 elyerr/horizon 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 elyerr/horizon 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 elyerr/horizon 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP AMQP Binding Library
A Laravel package to monitor queue jobs.
Message queue statistics for OroPlatform
Redis backed library for creating background jobs and processing them later.
Behat extention for RabbitMQ
Alfabank REST API integration
统计信息
- 总下载量: 305
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 26
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-24
