PHPackages                             xmlshop/laravel-queue-monitor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. xmlshop/laravel-queue-monitor

Abandoned → queue-monitorLibrary[Queues &amp; Workers](/categories/queues)

xmlshop/laravel-queue-monitor
=============================

Queue Monitoring for Laravel Database Job Queue

3.0.23(3y ago)01.8k[1 PRs](https://github.com/XMLSHOP/queue-monitor/pulls)MITPHPPHP ^8.0

Since May 8Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/XMLSHOP/queue-monitor)[ Packagist](https://packagist.org/packages/xmlshop/laravel-queue-monitor)[ GitHub Sponsors](https://github.com/xmlshop)[ RSS](/packages/xmlshop-laravel-queue-monitor/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (6)Dependencies (12)Versions (29)Used By (0)

Queue Monitor
=============

[](#queue-monitor)

For Laravel framework
---------------------

[](#for-laravel-framework)

[![Latest Stable Version](https://camo.githubusercontent.com/9d84d5f9905abbe3957b48f52f475c10650d2f5e2a04d8120a0a3fa610330fc6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f786d6c73686f702f71756575652d6d6f6e69746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xmlshop/queue-monitor)[![Total Downloads](https://camo.githubusercontent.com/cee5aaf8d4a591b823fa3e65de4932ca5c0b4d49a3fc85e59167829fe77240df/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f786d6c73686f702f71756575652d6d6f6e69746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xmlshop/queue-monitor)[![License](https://camo.githubusercontent.com/af47f9f0bd8d5f1695c4c20dad30093f45fbf9fa3a7e5c53c6f48a8016f1e94e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f786d6c73686f702f71756575652d6d6f6e69746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xmlshop/queue-monitor)

This package offers monitoring like [Laravel Horizon](https://laravel.com/docs/horizon) for database queue.

This package initially forked from [Laravel-Queue-Monitor](https://github.com/romanzipp/Laravel-Queue-Monitor).

Features
--------

[](#features)

- Monitor jobs like [Laravel Horizon](https://laravel.com/docs/horizon) for any queue
- Handle failing jobs with storing exception
- Monitor job progress
- Get an estimated time remaining for a job
- Store additional data for a job monitoring

Installation
------------

[](#installation)

```
composer require xmlshop/queue-monitor

```

Configuration
-------------

[](#configuration)

Copy configuration &amp; migration to your project:

```
php artisan vendor:publish --provider="xmlshop\QueueMonitor\Providers\MonitorProvider"  --tag=config --tag=migrations

```

Migrate the Queue Monitoring table. The table name can be configured in the config file or via the published migration.

```
php artisan migrate

```

Scheduler
---------

[](#scheduler)

```
class Kernel extends ConsoleKernel
{
    #...
    protected function schedule(Schedule $schedule)
    {
        #...
        $schedule->command('queue-monitor:aggregate-queues-sizes')->everyMinute();
        $schedule->command('queue-monitor:clean-up')->dailyAt('01:23');
        $schedule->command('queue-monitor:listener')->everyMinute();
        $schedule->command('monitor:sync-scheduler')->daily();
        $schedule->command('monitor:pid-checker')->everyMinute(); #for each node, if >1
        #...
    }
}

```

After the listener automatically will be launched `queue-monitor:listener`. It might be disabled in configuration or by command

```
#php artisan queue-monitor:listener disable {hours}
php artisan queue-monitor:listener disable 24 #disables alert-launcher for a day. By default 1 hour
php artisan queue-monitor:listener enable #enables that back
```

Application Error handler have to be replaced at your application Please add custom error handler:

```
final class Handler extends \Illuminate\Foundation\Exceptions\Handler implements \Illuminate\Contracts\Debug\ExceptionHandler
{
    /**
     * Render an exception to the console.
     *
     * @param \Symfony\Component\Console\Output\OutputInterface $output
     * @param \Throwable $e
     * @return void
     */
    final public function renderForConsole($output, Throwable $e)
    {
        $command_name = null;
        foreach (request()->server('argv') as $arg) {
            if (Str::contains($arg, ':')) {
                $command_name = $arg;
                break;
            }
        }

        if (null !== $command_name && class_exists('xmlshop\QueueMonitor\Services\CLIFailureHandler')) {
            app('xmlshop\QueueMonitor\Services\CLIFailureHandler')->handle($command_name, $e);
        }

        parent::renderForConsole($output, $e);
    }
}
```

And please register that in ApplicationProvider

```
$this->app->bind(\Illuminate\Contracts\Debug\ExceptionHandler::class, \App\Exceptions\Handler::class);
```

Alert function
--------------

[](#alert-function)

1. Listener looks into database in the `x_queue_monitoring_queue_sizes` table and comparing current amount with amount mentioned in field `alert_threshold`. If exceed - alert.
2. Listener looks into database in the `x_queue_monitoring` table and comparing several metrics (pending time, execution time, etc.)
3. You can manage exceptions for each Job. Including ignore alert.

Usage
-----

[](#usage)

To monitor a job, simply add the `xmlshop\QueueMonitor\Traits\IsMonitored` Trait.

```
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use xmlshop\QueueMonitor\Traits\IsMonitored; // group(function () {
    Route::queueMonitor();
});
```

### Routes

[](#routes)

RouteAction`/monitor`Show the jobs tableSee the [configuration files](https://github.com/XMLSHOP/queue-monitor/tree/master/config/monitor) for more information.

[![Preview](https://raw.githubusercontent.com/xmlshop/queue-monitor/master/preview.png)](https://raw.githubusercontent.com/xmlshop/queue-monitor/master/preview.png)

Extended usage
--------------

[](#extended-usage)

### Progress

[](#progress)

You can set a **progress value** (0-100) to get an estimation of a job progression.

```
use Illuminate\Contracts\Queue\ShouldQueue;
use xmlshop\QueueMonitor\Traits\IsMonitored;

class ExampleJob implements ShouldQueue
{
    use IsMonitored;

    public function handle()
    {
        $this->queueProgress(0);

        // Do something...

        $this->queueProgress(50);

        // Do something...

        $this->queueProgress(100);
    }
}
```

### Chunk progress

[](#chunk-progress)

A common scenario for a job is iterating through large collections.

This example job loops through a large amount of users and updates it's progress value with each chunk iteration.

```
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Database\Eloquent\Collection;
use xmlshop\QueueMonitor\Traits\IsMonitored;

class ChunkJob implements ShouldQueue
{
    use IsMonitored;

    public function handle()
    {
        $usersCount = User::count();

        $perChunk = 50;

        User::query()
            ->chunk($perChunk, function (Collection $users) use ($perChunk, $usersCount) {

                $this->queueProgressChunk($usersCount‚ $perChunk);

                foreach ($users as $user) {
                    // ...
                }
            });
    }
}
```

### Progress cooldown

[](#progress-cooldown)

To avoid flooding the database with rapidly repeating update queries, you can set override the `progressCooldown` method and specify a length in seconds to wait before each progress update is written to the database. Notice that cooldown will always be ignore for the values 0, 25, 50, 75 and 100.

```
use Illuminate\Contracts\Queue\ShouldQueue;
use xmlshop\QueueMonitor\Traits\IsMonitored;

class LazyJob implements ShouldQueue
{
    use IsMonitored;

    public function progressCooldown(): int
    {
        return 10; // Wait 10 seconds between each progress update
    }
}
```

### Custom data

[](#custom-data)

This package also allows setting custom data in array syntax on the monitoring model.

```
use Illuminate\Contracts\Queue\ShouldQueue;
use xmlshop\QueueMonitor\Traits\IsMonitored;

class CustomDataJob implements ShouldQueue
{
    use IsMonitored;

    public function handle()
    {
        $this->queueData(['foo' => 'Bar']);

        // WARNING! This is overriding the monitoring data
        $this->queueData(['bar' => 'Foo']);

        // To preserve previous data and merge the given payload, set the $merge parameter true
        $this->queueData(['bar' => 'Foo'], true);
    }
}
```

In order to show custom data on UI you need to add this line under `config/monitor.php`

```
'ui' => [
    ...

    'show_custom_data' => true,

    ...
]
```

### Only keep failed jobs

[](#only-keep-failed-jobs)

You can override the `keepMonitorOnSuccess()` method to only store failed monitor entries of an executed job. This can be used if you only want to keep failed monitors for jobs that are frequently executed but worth to monitor. Alternatively you can use Laravel's built in `failed_jobs` table.

```
use Illuminate\Contracts\Queue\ShouldQueue;
use xmlshop\QueueMonitor\Traits\IsMonitored;

class FrequentSucceedingJob implements ShouldQueue
{
    use IsMonitored;

    public static function keepMonitorOnSuccess(): bool
    {
        return false;
    }
}
```

### Retrieve processed Jobs

[](#retrieve-processed-jobs)

```
use xmlshop\QueueMonitor\Models\MonitorQueue;

$job = MonitorQueue::query()->first();

// Check the current state of a job
$job->isFinished();
$job->hasFailed();
$job->hasSucceeded();

// If the job is still running, get the estimated seconds remaining
// Notice: This requires a progress to be set
$job->getRemainingSeconds();
$job->getRemainingInterval(); // Carbon\CarbonInterval

// Retrieve any data that has been set while execution
$job->getData();

// Get the base name of the executed job
$job->getBasename();
```

### Model Scopes

[](#model-scopes)

```
use xmlshop\QueueMonitor\Models\MonitorQueue;

// Filter by Status
MonitorQueue::failed();
MonitorQueue::succeeded();

// Filter by Date
MonitorQueue::lastHour();
MonitorQueue::today();

// Chain Scopes
MonitorQueue::today()->failed();
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance61

Regular maintenance activity

Popularity15

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 76.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Recently: every ~25 days

Total

27

Last Release

1130d ago

Major Versions

1.1.0 → 2.0.02022-11-15

2.0.10 → 3.0.02022-12-21

PHP version history (2 changes)1.0.0PHP ^7.2|^8.0

1.1.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/d6714351d0d8bb4e0b468158b9fb682a6cb4698cbbb308c5da4553c7acb6354e?d=identicon)[ArtemNegriXMLShop](/maintainers/ArtemNegriXMLShop)

---

Top Contributors

[![romanzipp](https://avatars.githubusercontent.com/u/11266773?v=4)](https://github.com/romanzipp "romanzipp (216 commits)")[![pkulbida](https://avatars.githubusercontent.com/u/14273720?v=4)](https://github.com/pkulbida "pkulbida (27 commits)")[![artemn](https://avatars.githubusercontent.com/u/109627141?v=4)](https://github.com/artemn "artemn (23 commits)")[![davidhernandeze](https://avatars.githubusercontent.com/u/22482495?v=4)](https://github.com/davidhernandeze "davidhernandeze (4 commits)")[![darron1217](https://avatars.githubusercontent.com/u/8064923?v=4)](https://github.com/darron1217 "darron1217 (3 commits)")[![raavus-funkmaster](https://avatars.githubusercontent.com/u/42815989?v=4)](https://github.com/raavus-funkmaster "raavus-funkmaster (3 commits)")[![owenconti](https://avatars.githubusercontent.com/u/791222?v=4)](https://github.com/owenconti "owenconti (1 commits)")[![vadym-ovechkinxml](https://avatars.githubusercontent.com/u/92855211?v=4)](https://github.com/vadym-ovechkinxml "vadym-ovechkinxml (1 commits)")[![eboye](https://avatars.githubusercontent.com/u/624357?v=4)](https://github.com/eboye "eboye (1 commits)")[![emildayan](https://avatars.githubusercontent.com/u/22715782?v=4)](https://github.com/emildayan "emildayan (1 commits)")[![huzaifaarain](https://avatars.githubusercontent.com/u/8613679?v=4)](https://github.com/huzaifaarain "huzaifaarain (1 commits)")[![olegbannyi-coder](https://avatars.githubusercontent.com/u/186556408?v=4)](https://github.com/olegbannyi-coder "olegbannyi-coder (1 commits)")[![oleksandrbazylevych](https://avatars.githubusercontent.com/u/83021658?v=4)](https://github.com/oleksandrbazylevych "oleksandrbazylevych (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/xmlshop-laravel-queue-monitor/health.svg)

```
[![Health](https://phpackages.com/badges/xmlshop-laravel-queue-monitor/health.svg)](https://phpackages.com/packages/xmlshop-laravel-queue-monitor)
```

###  Alternatives

[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[romanzipp/laravel-queue-monitor

Queue Monitoring for Laravel Database Job Queue

8271.6M1](/packages/romanzipp-laravel-queue-monitor)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[palpalani/laravel-sqs-queue-json-reader

Custom SQS queue reader for Laravel

26109.8k](/packages/palpalani-laravel-sqs-queue-json-reader)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2011.0k](/packages/alajusticia-laravel-logins)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
