PHPackages                             ninoslavjaric/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. ninoslavjaric/queue-manager

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

ninoslavjaric/queue-manager
===========================

A Laravel-based queue management system with background job support.

v1.1.0(1y ago)08MITPHPPHP ^8.2

Since Nov 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ninoslavjaric/queue-manager)[ Packagist](https://packagist.org/packages/ninoslavjaric/queue-manager)[ RSS](/packages/ninoslavjaric-queue-manager/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (10)Used By (0)

[![Unit test execution](https://github.com/ninoslavjaric/queue-manager/actions/workflows/unittests.yaml/badge.svg)](https://github.com/ninoslavjaric/queue-manager/actions/workflows/unittests.yaml)[![Create Release](https://github.com/ninoslavjaric/queue-manager/actions/workflows/release.yaml/badge.svg)](https://github.com/ninoslavjaric/queue-manager/actions/workflows/release.yaml)[![codecov](https://camo.githubusercontent.com/2033e35d58a0b472df029d2d8493742f0a7f04d1b936f6279f0daaea0d03b3a9/68747470733a2f2f636f6465636f762e696f2f6769746875622f6e696e6f736c61766a617269632f71756575652d6d616e616765722f67726170682f62616467652e7376673f746f6b656e3d48384436433447545935)](https://codecov.io/github/ninoslavjaric/queue-manager)

Custom Queue Manager for Laravel
================================

[](#custom-queue-manager-for-laravel)

Overview
--------

[](#overview)

The Custom Queue Manager is a Laravel plugin designed to execute PHP classes as background jobs, independent of Laravel's built-in queue system. This system provides scalability, error handling, and ease of use while executing tasks asynchronously. It supports multiple queue storage drivers, starting with Eloquent and planning to extend to Redis.

---

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

[](#installation)

1. **Install the package** via Composer:

    ```
    composer require ninoslavjaric/queue-manager
    ```
2. **Run migrations** to set up the necessary database tables:

    ```
    php artisan migrate
    ```
3. **Add the scheduler** to your crontab to run the queue daemon:

    ```
    php artisan schedule:run
    ```

---

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

[](#configuration)

The configuration file for the QueueManager may be overriden and can be found in `config/custom_queue.php`. Here's an example of the configuration:

```
return [
    'driver' => env('CUSTOM_QUEUE_DRIVER', 'eloquent'),
    'queue-pool-limit' => 2,
    'drivers' => [
        'eloquent' => \Nino\CustomQueueLaravel\Services\QueueManager\Eloquent::class,
        'redis' => \Nino\CustomQueueLaravel\Services\QueueManager\Redis::class,
    ],
    // Optional: Limit queueable classes
    'whitelisted_classes' => [],
    'blacklisted_classes' => [],
    'task-class' => \Nino\CustomQueueLaravel\Models\CustomQueueTask::class
];
```

- **`driver`**: Choose the queue storage driver (Eloquent, Redis).
- **`queue-pool-limit`**: Set the maximum number of concurrent tasks that can be processed. Default is 2.
- **`drivers`**: Define the drivers (currently Eloquent and Redis).
- **`whitelisted_classes` &amp; `blacklisted_classes`**: Use these arrays to restrict which classes are allowed to be queued.

---

Main Components
---------------

[](#main-components)

### QueueManager

[](#queuemanager)

The central class in this solution is `QueueManager`. It orchestrates all the actions in the queue system. It is an abstract class, and different storage backends extend it (e.g., `Eloquent`, `Redis`).

### Crucial Methods

[](#crucial-methods)

1. **`queueDaemonFunction`**:

    - This function is scheduled to run every 2 seconds.
    - It retrieves idle tasks and creates asynchronous background jobs to execute specific tasks.
2. **`runBackgroundJob`**:

    - This function is executed by an asynchronous background job to process the task.
3. **`append`**:

    - This method pushes a task to the queue table, but only if it passes the validation.
4. **`push`**:

    - Adds a task to the queue table.
5. **`pop`**:

    - Fetches a list of tasks with the highest priority and oldest timestamps. You can specify the number of tasks to retrieve via the `limit` parameter.

---

Logging
-------

[](#logging)

There are two types of logs:

- **Default logger**: Logs regular task execution.
- **Error logger**: Logs failed tasks or errors during task processing.

The log entries are structured as follows:

```
[2024-11-21 20:36:47] local.INFO: [nino/app/Services/QueueManager.php:219] {"flag":"custom-queue:daemon","queuePoolLimit":3} -----> Cancelling tasks that aren't running in system
```

- **Log format**: Includes context (e.g., task details) and the log level.
- **Log files**:
    - `background_jobs.log`: For regular logs.
    - `background_jobs_errors.log`: For error logs.

---

Queue Daemon
------------

[](#queue-daemon)

The queue system runs a **daemon** that continuously monitors and executes background tasks. The daemon is triggered via the `custom-queue:daemon` command, and it processes tasks using the `php artisan custom-queue:task-bg-execute {uuid}` command.

### Example Log Entries

[](#example-log-entries)

- Task preparation: ```
    [2024-11-21 20:36:47] local.INFO: [nino/app/Services/QueueManager.php:233] {"flag":"custom-queue:daemon","queuePoolLimit":3,"tasksExtractedCount":2} -----> Preparing tasks for execution
    ```
- Task execution: ```
    [2024-11-21 20:36:47] local.INFO: [nino/app/Services/QueueManager.php:246] {"flag":"custom-queue:daemon","queuePoolLimit":3,"tasksExtractedCount":2,"cmd":"'\/usr\/local\/bin\/php' '\/var\/www\/html\/artisan' 'custom-queue:task-bg-execute' '4919f8b9-06b9-4902-a96f-80c9bd7a8203'"} -----> Running task in background
    ```

---

Web Interface
-------------

[](#web-interface)

The plugin exposes a **web UI** for managing background tasks. You can list tasks, monitor their status, and cancel any running tasks. The web interface is available at `/nino-queue-manager`.

---

Methods for Users
-----------------

[](#methods-for-users)

1. **`append`**:

    - Used programmatically to add a task to the queue.
2. **`cancelTask`**:

    - Exposed via URL to cancel a specific task.
3. **`getTasks`**:

    - Exposed via URL to retrieve a list of all tasks.

The QueueManager is registered as a singleton via a service provider and is injectable across your Laravel application.

---

Scheduled Task
--------------

[](#scheduled-task)

The queue daemon is scheduled using Laravel's scheduler:

```
$schedule->command('custom-queue:daemon')->everyTwoSeconds();
```

Ensure the cron job for `php artisan schedule:run` is set up.

---

Conclusion
----------

[](#conclusion)

This Custom Queue Manager provides a simple yet scalable solution for background task execution in Laravel, independent of the default queue system. It allows for easy management of tasks, logging, and web-based task management. By supporting multiple storage drivers and offering fine-grained control over task execution, it is flexible and highly customizable.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Every ~0 days

Total

8

Last Release

533d ago

Major Versions

v0.9.3 → v1.0.02024-11-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/139b190d4eeee034199433716ae57703599386b4f60d4ba34041a7ccc2ca22bc?d=identicon)[jaricninoslav](/maintainers/jaricninoslav)

---

Top Contributors

[![ninoslavjaric](https://avatars.githubusercontent.com/u/11066613?v=4)](https://github.com/ninoslavjaric "ninoslavjaric (23 commits)")

---

Tags

laravellaravel-packagebackground-jobstask-queuequeue manager

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ninoslavjaric-queue-manager/health.svg)

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

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[iamfarhad/laravel-rabbitmq

A robust RabbitMQ driver for Laravel Queue with advanced message queuing, reliable delivery, and high-performance async processing capabilities

3215.6k](/packages/iamfarhad-laravel-rabbitmq)[croustibat/filament-jobs-monitor

Background Jobs monitoring like Horizon for all drivers for FilamentPHP

254255.2k6](/packages/croustibat-filament-jobs-monitor)[mpbarlow/laravel-queue-debouncer

A wrapper job for debouncing other queue jobs.

63714.4k1](/packages/mpbarlow-laravel-queue-debouncer)[convenia/pigeon

3233.0k](/packages/convenia-pigeon)[pierophp/laravel-queue-manager

Laravel Queue Manager

182.4k](/packages/pierophp-laravel-queue-manager)

PHPackages © 2026

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