PHPackages                             balkar/laravel-priority-queue-manager - 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. balkar/laravel-priority-queue-manager

ActiveLibrary[Queues &amp; Workers](/categories/queues)

balkar/laravel-priority-queue-manager
=====================================

Dispatch and manage Laravel jobs with priority levels — critical, high, normal, low.

v1.0.0(1mo ago)01MITPHPPHP ^8.2CI passing

Since Jun 10Pushed 1mo agoCompare

[ Source](https://github.com/balkar1998/laravel-priority-queue-manager)[ Packagist](https://packagist.org/packages/balkar/laravel-priority-queue-manager)[ RSS](/packages/balkar-laravel-priority-queue-manager/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Laravel Priority Queue Manager
==============================

[](#laravel-priority-queue-manager)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9c8ba4aaf705ce9474625320075cdffa3b2bb51f27cc5cd624bd5a5147b2fa72/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62616c6b61722f6c61726176656c2d7072696f726974792d71756575652d6d616e616765722e737667)](https://packagist.org/packages/balkar/laravel-priority-queue-manager)[![Total Downloads](https://camo.githubusercontent.com/9928cf880412d04e05369c5bb87aa772bc48dd96466b0d0423794d3d9ca0ee77/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62616c6b61722f6c61726176656c2d7072696f726974792d71756575652d6d616e616765722e737667)](https://packagist.org/packages/balkar/laravel-priority-queue-manager)[![Tests](https://github.com/balkar1998/laravel-priority-queue-manager/actions/workflows/tests.yml/badge.svg)](https://github.com/balkar1998/laravel-priority-queue-manager/actions)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://opensource.org/licenses/MIT)[![PHP Version](https://camo.githubusercontent.com/c9f64f714c636ba27a3bba6dfd52f98426832db1262747efa54b212d16943651/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d626c7565)](https://www.php.net/)[![Laravel](https://camo.githubusercontent.com/f9f1aee5261b3b9aa8b1f3094ea1fe03a38308a41ba790f53ec2a6a767a81137/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31302532302537432532303131253230253743253230313225323025374325323031332d726564)](https://laravel.com)

A Laravel package that standardises priority queue dispatching across your team — with a clean Facade API, a shared config file, and a built-in artisan command to monitor queue health.

---

Why This Exists
---------------

[](#why-this-exists)

Laravel already supports named queues. You can do this:

```
dispatch(new SendOTP($user))->onQueue('high');

php artisan queue:work --queue=high,low
```

That works fine for a solo developer. In a team it breaks down:

- One dev writes `'high'`, another writes `'urgent'`, another forgets `->onQueue()` entirely and it silently hits the default queue
- No shared definition of what priority levels exist or what they mean
- No way to check queue depth per priority without writing a raw DB query
- Retry config and worker counts live in Supervisor files, deployment scripts, or someone's head

This package fixes all of that with a shared standard your whole team uses.

---

What It Does
------------

[](#what-it-does)

**Consistent dispatch API:**

```
use Balkar\PriorityQueue\Facades\Priority;

Priority::critical(new SendOTPJob($user));
Priority::high(new SendInvoiceJob($order));
Priority::normal(new SendWelcomeEmail($user));
Priority::low(new SendNewsletterJob($batch));
```

**One config file for the whole team:**

```
// config/priority-queue.php
return [
    'priorities' => [
        'critical' => ['retry_after' => 30,  'tries' => 5],
        'high'     => ['retry_after' => 60,  'tries' => 4],
        'normal'   => ['retry_after' => 90,  'tries' => 3],
        'low'      => ['retry_after' => 300, 'tries' => 2],
    ],
];
```

**Queue health at a glance:**

```
php artisan queue:priority-status
```

+----------+-------------+-----------+-------------+--------+

| Priority | Queued Jobs | Max Tries | Retry After | Status |

+----------+-------------+-----------+-------------+--------+

| CRITICAL | 0 | 5 | 30s | IDLE |

| HIGH | 4 | 4 | 60s | ACTIVE |

| NORMAL | 23 | 3 | 90s | ACTIVE |

| LOW | 150 | 2 | 300s | BUSY |

+----------+-------------+-----------+-------------+--------+

---

Requirements
------------

[](#requirements)

LaravelPHP10.x8.2+11.x8.2+12.x8.2+13.x8.3+---

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

[](#installation)

```
composer require balkar/laravel-priority-queue-manager
```

Publish the config:

```
php artisan vendor:publish --tag=priority-queue-config
```

---

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

[](#configuration)

`config/priority-queue.php` after publishing:

```
return [
    'priorities' => [
        'critical' => ['retry_after' => 30,  'tries' => 5],
        'high'     => ['retry_after' => 60,  'tries' => 4],
        'normal'   => ['retry_after' => 90,  'tries' => 3],
        'low'      => ['retry_after' => 300, 'tries' => 2],
    ],
];
```

`retry_after` is in seconds. `tries` is the maximum number of attempts before a job fails.

---

Usage
-----

[](#usage)

### Dispatching jobs

[](#dispatching-jobs)

```
use Balkar\PriorityQueue\Facades\Priority;

Priority::critical(new SendOTPJob($user));
Priority::high(new SendInvoiceJob($order));
Priority::normal(new SendWelcomeEmail($user));
Priority::low(new SendNewsletterJob($batch));
```

Under the hood this calls Laravel's native `dispatch($job)->onQueue($priority)` — no magic, just a consistent API on top of what Laravel already does.

### Running workers

[](#running-workers)

Start a single worker that respects priority order:

```
php artisan queue:work --queue=critical,high,normal,low
```

Laravel processes `critical` first. Only when it is empty does it move to `high`, and so on.

### Production worker management

[](#production-worker-management)

Use Supervisor to keep workers running. Example config:

```
[program:queue-critical]
command=php /var/www/html/artisan queue:work --queue=critical --tries=5 --timeout=30
numprocs=3
autostart=true
autorestart=true
stderr_logfile=/var/log/supervisor/queue-critical.err.log

[program:queue-low]
command=php /var/www/html/artisan queue:work --queue=low --tries=2 --timeout=300
numprocs=1
autostart=true
autorestart=true
stderr_logfile=/var/log/supervisor/queue-low.err.log
```

Supervisor is one option — you can also use systemd, Docker, or your platform's native process manager. The package has no dependency on any specific process manager.

---

Monitoring
----------

[](#monitoring)

```
php artisan queue:priority-status
```

+----------+-------------+-----------+-------------+--------+

| Priority | Queued Jobs | Max Tries | Retry After | Status |

+----------+-------------+-----------+-------------+--------+

| CRITICAL | 0 | 5 | 30s | IDLE |

| HIGH | 4 | 4 | 60s | ACTIVE |

| NORMAL | 23 | 3 | 90s | ACTIVE |

| LOW | 150 | 2 | 300s | BUSY |

+----------+-------------+-----------+-------------+--------+

Status is based on current job count in the database queue table:

- `IDLE` — 0 jobs
- `ACTIVE` — 1 to 10 jobs
- `BUSY` — more than 10 jobs

This command reads from the `jobs` table and works with the `database` queue driver out of the box. For Redis, SQS, or other drivers the count will show 0 — driver-specific monitoring support is on the roadmap.

---

Known Limitations
-----------------

[](#known-limitations)

**Starvation** — strict priority ordering means low priority jobs can wait indefinitely if critical and high queues stay full. The monitoring command gives you visibility into this. Configurable max wait time with automatic job promotion is planned for v1.1.

**Driver support** — `queue:priority-status` job counts currently only work with the `database` driver.

**No automatic worker management** — the package standardises dispatch and config. Starting and managing worker processes is your responsibility via Supervisor, systemd, or your deployment setup.

---

Real World Context
------------------

[](#real-world-context)

At my previous company we built a student grade calculation engine that processed recursive async jobs across thousands of students. When teachers triggered bulk mark updates, thousands of recalculation jobs would fill the queue and block time-sensitive jobs like OTP delivery.

The fix was named queues with strict priority ordering — this package came out of making that pattern reusable and consistent across the team.

```
// triggered by exam update — needs to run immediately
Priority::critical(new RecalculateStudentGrade($student, $exam));

// nightly bulk export — can wait
Priority::low(new GenerateBulkReportJob($cohort));
```

---

Roadmap
-------

[](#roadmap)

- Anti-starvation: configurable max wait time with automatic job promotion
- Redis and SQS driver support for queue:priority-status
- Lumen support
- Prometheus metrics export

---

Testing
-------

[](#testing)

```
composer test
```

---

Changelog
---------

[](#changelog)

Please see [CHANGELOG.md](CHANGELOG.md) for recent changes.

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes please open an issue first to discuss what you would like to change.

License
-------

[](#license)

MIT. Please see [LICENSE](LICENSE) for more information.

Author
------

[](#author)

**Balkar Singh**

[balkar.co.in](https://balkar.co.in)[GitHub](https://github.com/balkar1998)[LinkedIn](https://linkedin.com/in/balkar-singh-6828a7234)

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance91

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/66656246?v=4)[Balkar singh](/maintainers/balkar1998)[@balkar1998](https://github.com/balkar1998)

---

Top Contributors

[![balkar1998](https://avatars.githubusercontent.com/u/66656246?v=4)](https://github.com/balkar1998 "balkar1998 (15 commits)")

---

Tags

laravelqueuejobsworkerpriority

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/balkar-laravel-priority-queue-manager/health.svg)

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M322](/packages/laravel-horizon)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

45955.7k](/packages/harris21-laravel-fuse)[dusterio/laravel-aws-worker

Run Laravel (or Lumen) tasks and queue listeners inside of AWS Elastic Beanstalk workers

3115.9M](/packages/dusterio-laravel-aws-worker)

PHPackages © 2026

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