Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

Laravel-Queue-Monitor

> 后端框架
Open source

Monitoring Laravel Jobs with your Database

830 stars0 likes6 views
WebsiteGitHub

About

Monitoring Laravel Jobs with your Database

Laravel Queue Monitor

This package offers monitoring like Laravel Horizon for database queue.

Features

  • Monitor jobs like Laravel 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
  • Retry jobs via the UI

Installation

composer require romanzipp/laravel-queue-monitor

There is an additional package romanzipp/Laravel-Queue-Monitor-Nova for Laravel Nova resources & metrics.

Upgrading

✨ See Upgrade Guide if you are updating to 5.0 ✨

  • Upgrading to 4.0 from 3.0
  • Upgrading to 3.0 from 2.0
  • Upgrading to 2.0 from 1.0

Configuration

Copy configuration & migration to your project:

php artisan vendor:publish --provider="romanzipp\QueueMonitor\Providers\QueueMonitorProvider" --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

Usage

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

php
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use romanzipp\QueueMonitor\Traits\IsMonitored; // queueProgress(0);

        // Do something...

        $this->queueProgress(50);

        // Do something...

        $this->queueProgress(100);
    }
}

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 its progress value with each chunk iteration.

…

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.

php
use Illuminate\Contracts\Queue\ShouldQueue;
use romanzipp\QueueMonitor\Traits\IsMonitored;

class LazyJob implements ShouldQueue
{
    use IsMonitored;

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

Custom data

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

php
use Illuminate\Contracts\Queue\ShouldQueue;
use romanzipp\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/queue-monitor.php

php
'ui' => [
    ...

    'show_custom_data' => true,

    ...
]

Initial data

This package also allows setting initial data to set when the job is queued.

php
use Illuminate\Contracts\Queue\ShouldQueue;
use romanzipp\QueueMonitor\Traits\IsMonitored;

class InitialDataJob implements ShouldQueue
{
    use IsMonitored;
    
    public function __construct(private $channel)
    {
    }

    public function initialMonitorData()
    {
        return ['channel_id' => $this->channel];
    }
}

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.

php
use Illuminate\Contracts\Queue\ShouldQueue;
use romanzipp\QueueMonitor\Traits\IsMonitored;

class FrequentSucceedingJob implements ShouldQueue
{
    use IsMonitored;

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

Retrieve processed Jobs

…

Model Scopes

php
use romanzipp\QueueMonitor\Models\Monitor;

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

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

// Chain Scopes
Monitor::today()->failed();

Tests

The easiest way to execute tests locally is via Lando. The Lando config file automatically spins up app & database containers.

bash
lando start

lando phpunit-sqlite
lando phpunit-mysql
lando phpunit-postgres

Upgrading

  • Upgrade from 2.0 to 3.0
  • Upgrade from 1.0 to 2.0

License

The MIT License (MIT). Please see License File for more information.


This package was inspired by gilbitron's laravel-queue-monitor which is not maintained anymore.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHPlaravelphpphp7queue

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架