willypelz/queue-monitor
Composer 安装命令:
composer require willypelz/queue-monitor
包简介
A Laravel queue monitor with database driver support, controls, and metrics.
README 文档
README
A powerful Laravel queue monitoring package with database driver support, advanced metrics, and operational controls.
Better than Horizon - Full database driver support, advanced controls, lightweight, and easy to install.
Table of Contents
- Features
- Installation
- Quick Start
- Configuration
- Usage
- API Documentation
- Comparison with Horizon
- Requirements
- Documentation
- Contributing
- License
Features
- 📊 Real-time Dashboard - Monitor queue jobs with live updates
- 🎛️ Operational Controls - Pause, resume, throttle, and retry queues
- 📈 Rich Metrics - Track job success rates, runtime, and failures
- 💾 Database Driver Support - Full support for database queue driver
- 🚀 Performance Optimized - Indexed queries and efficient data retention
- 🔒 Secure - Customizable middleware for dashboard protection
Installation
Quick Install
composer require willypelz/queue-monitor php artisan queue-monitor:install
That's it! Visit http://your-app.test/queue-monitor to see your dashboard.
✅ Auto-Discovery: This package supports Laravel's auto-discovery feature. The service provider is automatically registered when you install the package.
🔒 HTTPS Ready: All external resources use HTTPS to prevent mixed-content blocking. Works seamlessly with secure applications.
Manual Installation
Install the package via Composer:
composer require willypelz/queue-monitor
Publish the configuration and migrations:
php artisan vendor:publish --provider="QueueMonitor\QueueMonitorServiceProvider"
Or publish individually:
# Publish config php artisan vendor:publish --tag=queue-monitor-config # Publish migrations php artisan vendor:publish --tag=queue-monitor-migrations # Publish views (optional, for customization) php artisan vendor:publish --tag=queue-monitor-views
Run the migrations:
php artisan migrate
Configuration
The configuration file is published to config/queue-monitor.php:
return [ // Dashboard route path 'path' => 'queue-monitor', // Middleware for dashboard access 'middleware' => ['web'], // Storage driver: 'database' or 'redis' 'driver' => env('QUEUE_MONITOR_DRIVER', 'database'), // Redis configuration (when driver is 'redis') 'redis' => [ 'connection' => env('QUEUE_MONITOR_REDIS_CONNECTION', 'default'), ], // Retention period in days 'retention_days' => 14, // UI refresh interval 'ui' => [ 'refresh_seconds' => 10, ], // Control settings 'control' => [ 'pause_release_seconds' => 10, 'throttle_default_rate_per_minute' => 60, 'throttle_release_seconds' => 5, ], ];
Storage Drivers
Database Driver (Default)
QUEUE_MONITOR_DRIVER=database
- Persistent storage
- SQL queries supported
- Best for moderate volume
Redis Driver (High Performance)
QUEUE_MONITOR_DRIVER=redis QUEUE_MONITOR_REDIS_CONNECTION=default
- 20x faster than database
- Perfect for high-volume queues
- Memory-based with TTL expiration
- See Redis Driver Guide for details
Securing the Dashboard
Add authentication middleware to protect the dashboard:
'middleware' => ['web', 'auth'],
Or create custom middleware for role-based access:
'middleware' => ['web', 'auth', 'can:view-queue-monitor'],
Usage
Accessing the Dashboard
Once installed, visit the dashboard at:
http://your-app.test/queue-monitor
Dashboard Features
- Stats Overview: View total, processed, failed, and processing jobs
- Average Runtime: Monitor job performance
- Recent Jobs: See the latest job executions
- Queue Controls: Pause, resume, throttle, or retry queues
Queue Controls
Pause Queue
Temporarily stop processing jobs on a specific queue:
# Via Dashboard UI or API POST /queue-monitor/api/control/pause { "connection": "database", "queue": "default" }
Resume Queue
Resume a paused queue:
POST /queue-monitor/api/control/resume
{
"connection": "database",
"queue": "default"
}
Throttle Queue
Limit the number of jobs processed per minute:
POST /queue-monitor/api/control/throttle
{
"connection": "database",
"queue": "default",
"rate": 60
}
Retry Failed Jobs
Retry all failed jobs on a queue:
POST /queue-monitor/api/control/retry
{
"connection": "database",
"queue": "default"
}
Programmatic Usage
You can also interact with the queue monitor programmatically:
use QueueMonitor\Services\QueueControlService; $control = app(QueueControlService::class); // Pause a queue $control->pause('database', 'default'); // Resume a queue $control->resume('database', 'default'); // Throttle a queue $control->throttle('database', 'default', 30); // Check if paused $isPaused = $control->isPaused('database', 'default'); // Get throttle rate $rate = $control->getThrottleRate('database', 'default');
Pruning Old Records
Keep your database clean by pruning old job records:
# Prune records older than 14 days (default) php artisan queue-monitor:prune # Prune records older than 7 days php artisan queue-monitor:prune --days=7
Schedule automatic pruning in app/Console/Kernel.php:
protected function schedule(Schedule $schedule) { $schedule->command('queue-monitor:prune')->daily(); }
Driver Comparison
Choose the right storage driver for your needs:
| Feature | Database Driver | Redis Driver |
|---|---|---|
| Performance | ~10ms per job | ~0.5ms per job (20x faster) |
| Throughput | 200 jobs/sec | 5,000+ jobs/sec |
| Storage | Persistent (disk) | Memory with TTL |
| Data Retention | Permanent | Configurable expiration |
| Queries | Full SQL support | Key-value only |
| Setup | Requires migrations | No migrations needed |
| Best For | Low-medium volume, SQL analytics | High volume, real-time updates |
| Memory Usage | Database storage | RAM (1-5 KB per job) |
When to Use Redis
✅ Processing 1000+ jobs per minute ✅ Multiple servers sharing monitoring data ✅ Real-time dashboard updates required ✅ Want to reduce database load ✅ Already using Redis for cache/queues
When to Use Database
✅ Low to medium job volume ✅ Need permanent data storage ✅ SQL queries for reporting ✅ Single server deployment ✅ Compliance/audit requirements
To use database driver instead:
# .env QUEUE_MONITOR_DRIVER=database
See Redis Driver Guide for detailed comparison and migration instructions.
API Endpoints
All API endpoints are prefixed with /queue-monitor/api:
| Method | Endpoint | Description |
|---|---|---|
| GET | /stats |
Get dashboard statistics |
| GET | /jobs |
Get recent jobs |
| POST | /control/pause |
Pause a queue |
| POST | /control/resume |
Resume a queue |
| POST | /control/throttle |
Throttle a queue |
| POST | /control/retry |
Retry failed jobs |
Comparison with Horizon
| Feature | Queue Monitor | Horizon |
|---|---|---|
| Database Driver | ✅ Full support | ❌ Redis only |
| Custom Controls | ✅ Pause, throttle, retry | ⚠️ Limited |
| Lightweight | ✅ Minimal overhead | ❌ Heavy |
| Easy Installation | ✅ Composer only | ⚠️ Requires config |
| Real-time UI | ✅ Vue 3 | ✅ Vue 2 |
| Metrics Depth | ✅ Rich stats | ✅ Rich stats |
| Open Source | ✅ MIT | ✅ MIT |
Requirements
- PHP 8.1 or higher
- Laravel 10.x, 11.x, or 12.x
- Database (MySQL, PostgreSQL, SQLite, etc.) or Redis
Documentation
- Installation Guide - Detailed installation instructions
- Redis Driver Guide - NEW! High-performance Redis storage
- Queue Controls - Pause, resume, throttle, and retry
- API Documentation - RESTful API endpoints
- Middleware Setup - Job middleware configuration
- Security Considerations - HTTPS, mixed-content prevention, and access control
- API Endpoint Fix - Fix blocked:mixed-content for API calls
- Advanced Features - Performance optimization, alerting, and more
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Changelog
Please see CHANGELOG.md for recent changes.
Security
If you discover any security-related issues, please email willypelz@example.com instead of using the issue tracker.
Credits
- Author: Willy Pelz
- Inspired by: Laravel Horizon, romanzipp/laravel-queue-monitor
- Built with: Laravel, Vue.js 3, Tailwind CSS
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: docs/
License
This package is open-sourced software licensed under the MIT license.
Made with ❤️ for the Laravel community
willypelz/queue-monitor 适用场景与选型建议
willypelz/queue-monitor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 67 次下载、GitHub Stars 达 3, 最近一次更新时间为 2026 年 02 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「queue」 「Metrics」 「monitor」 「laravel」 「jobs」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 willypelz/queue-monitor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 willypelz/queue-monitor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 willypelz/queue-monitor 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Store your language lines in the database, yaml or other sources
PHP AMQP Binding Library
A Laravel package to monitor queue jobs.
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
A PSR-7 compatible library for making CRUD API endpoints
统计信息
- 总下载量: 67
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-24