Looking to hire Laravel developers? Try LaraJobs

laravel-queue-jobs maintained by olorunda

Description
Comprehensive queue job inspector, monitor, and manager for Laravel across Database, Redis, and Failed Job drivers via CLI and Web Dashboard
Author
Olorunda
Last update
2026/09/16 18:34 (dev-main)
License
Links
Downloads
39

Comments
comments powered by Disqus

Laravel Queue Jobs Inspector (olorunda/laravel-queue-jobs)

Latest Version on Packagist Total Downloads License

A modern, high-performance Laravel package to display, inspect, monitor, and manage queued jobs across Database, Redis, and Failed Job stores via Artisan CLI commands, a Live Web Dashboard, and a Programmatic PHP API.


Features

  • 📊 Comprehensive Queue Visibility: View pending, delayed (with countdowns), in-flight (reserved), and failed jobs.
  • 💻 Rich Artisan CLI:
    • php artisan queue:jobs: Formatted colored table with status badges and metrics.
    • --watch: Live refreshing terminal dashboard (auto-updates every few seconds).
    • --detail=<ID>: Deep payload inspection (unserialized properties, tags, and stack traces).
    • --json: Machine-readable JSON for CI/CD or logging pipelines.
    • php artisan queue:job:retry <id>: Retry failed jobs directly.
    • php artisan queue:job:delete <id>: Cancel/delete queued jobs.
  • 🚀 Multi-Driver Engine:
    • Database Driver: Direct inspection of jobs and failed_jobs tables with lock states and delay schedules.
    • Redis Driver: Direct inspection of Redis lists (queues:{name}) and sorted sets (queues:{name}:delayed, queues:{name}:reserved).
    • Extensible driver interface to plug in custom queues.
  • 🌐 Modern Web Dashboard & REST API:
    • Out-of-the-box UI at /queue-jobs (no NPM/Webpack build required).
    • Real-time stats cards, filter by status, filter by queue, search by job name or payload.
    • JSON modal viewer for extracted job constructor parameters and payloads.
  • 🛡️ Safe Deserialization:
    • Safely inspects job parameters without crashing even if Eloquent models or specific classes are absent.

Installation

You can install the package via composer:

composer require olorunda/laravel-queue-jobs

Publish configuration and dashboard assets (optional):

php artisan vendor:publish --tag=queue-jobs-config
php artisan vendor:publish --tag=queue-jobs-views

Configuration (config/queue-jobs.php)

return [
    // The queue connection to inspect (null = default queue connection)
    'connection' => env('QUEUE_JOBS_CONNECTION', null),

    // Queues monitored by default
    'queues' => [
        'default',
    ],

    // Database tables
    'tables' => [
        'jobs' => 'jobs',
        'failed_jobs' => 'failed_jobs',
    ],

    // Redis settings
    'redis' => [
        'connection' => 'default',
        'prefix' => 'queues:',
    ],

    // Web dashboard
    'web' => [
        'enabled' => env('QUEUE_JOBS_WEB_ENABLED', true),
        'path' => 'queue-jobs',
        'middleware' => ['web'], // Add 'auth' or custom gates if needed
    ],
];

Usage

1. Artisan CLI Commands

View all queued jobs:

php artisan queue:jobs
 LARAVEL QUEUE INSPECTOR   Connection: database [All Queues]
 Pending: 3  |  In-Flight: 1  |  Delayed: 2  |  Failed: 0  |  Total: 6

+----+---------+----------------------------------+------------+----------+-------------------+------------+
| ID | Queue   | Job / Handler                    | Status     | Attempts | Delay / Scheduled | Tags       |
+----+---------+----------------------------------+------------+----------+-------------------+------------+
| 12 | default | SendWelcomeEmail                 | PENDING    | 0        | -                 | auth, user |
| 13 | default | GenerateMonthlyReport            | PROCESSING | 1        | -                 | reports    |
| 14 | billing | ChargeSubscriptionPayment        | DELAYED    | 0        | 45s               | billing    |
+----+---------+----------------------------------+------------+----------+-------------------+------------+

Filter by Status, Queue, or Connection:

php artisan queue:jobs --status=delayed
php artisan queue:jobs --status=failed
php artisan queue:jobs --queue=billing
php artisan queue:jobs --connection=redis

Live Watch Mode (Auto-refreshing Terminal Monitor):

php artisan queue:jobs --watch --interval=2

Inspect Job Details & Extracted Parameters:

php artisan queue:jobs --detail=12

Output as JSON:

php artisan queue:jobs --json

Delete / Cancel a Queued Job:

php artisan queue:job:delete 12

Retry a Failed Job or Retry All Failed Jobs:

# Retry a specific failed job by ID or UUID
php artisan queue:job:retry 12

# Retry ALL failed jobs across all queues
php artisan queue:job:retry --all

# Retry all failed jobs in a specific queue
php artisan queue:job:retry --all --queue=billing

2. Web Dashboard

Visit http://your-app.test/queue-jobs in your browser.

  • Real-time aggregate count cards for Pending, Delayed, In-Flight, Failed, and Total.
  • One-click "Retry All Failed" button in the header.
  • "Retry" button on failed jobs and "Run Now" button on delayed/in-flight jobs to execute them immediately.
  • Dynamic search and queue filtering.
  • One-click modal to inspect job constructor arguments, raw payload, and stack traces.
  • One-click Delete actions.

To protect the route with authentication, update config/queue-jobs.php:

'web' => [
    'enabled' => true,
    'path' => 'admin/queues',
    'middleware' => ['web', 'auth', 'can:viewQueueDashboard'],
],

3. Programmatic PHP API / Facade

You can use the QueueJobs facade anywhere in your Laravel application:

use Olorunda\QueueJobs\Facades\QueueJobs;

// Get all jobs with filters
$jobs = QueueJobs::all(['status' => 'pending', 'queue' => 'default']);

// Quick status helpers
$pendingJobs = QueueJobs::pending(queue: 'default', limit: 25);
$delayedJobs = QueueJobs::delayed();
$reservedJobs = QueueJobs::reserved();
$failedJobs = QueueJobs::failed();

// Get queue metrics
$stats = QueueJobs::stats();
// Returns: ['pending' => 5, 'delayed' => 2, 'reserved' => 1, 'failed' => 0, 'total' => 8]

// Find job by ID
$job = QueueJobs::find(14);
if ($job) {
    echo $job->name;              // "App\Jobs\ChargeSubscriptionPayment"
    echo $job->shortName();         // "ChargeSubscriptionPayment"
    echo $job->delayHuman();        // "45s"
    print_r($job->commandData);    // Extracted constructor properties
}

// Retry a specific job or retry ALL failed jobs
QueueJobs::retry(12);
QueueJobs::retryAll(queue: 'default');

// Make a delayed or stuck reserved job run immediately
QueueJobs::runNow(14);

// Delete / cancel a job
QueueJobs::delete(14);

// Clear all pending jobs in a queue
QueueJobs::clear('notifications');

Testing

composer test

License

The MIT License (MIT). Please see LICENSE.md for more information.