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

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

moharram82/queue
================

Queue is a PHP package for executing time-consuming tasks in the background.

v2.0.0(2y ago)03GPL-3.0PHPPHP &gt;=8.1

Since Mar 7Pushed 2y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (5)Used By (0)

Queue Package
=============

[](#queue-package)

Introduction
------------

[](#introduction)

This is a PHP Queue package for executing time-consuming tasks in the background.

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

[](#requirements)

- PHP 8.1+
- MySQL 5.6+ (for database driver)

Installation &amp; Configuration
--------------------------------

[](#installation--configuration)

- Install using composer:

```
composer require moharram82/php-queue

```

- Create the queues table by executing `table.sql` file
- Instantiate a new `\Moharram82\Queue\QueueConfig` instance, which accepts an optional configuration array.

```
$config = new \Moharram82\Queue\QueueConfig([
    'queue' => 'default',
    'retry_after' => 90, // in seconds
    'table' => 'queues', // database driver table name
]);
```

- Instantiate a driver implementation of `\Moharram82\Queue\QueueInterface` instance like `\Moharram82\Queue\MySQLQueue`

```
$database_connection_options = [
    'host' => '127.0.0.1',
    'username' => 'root',
    'password' => '',
    'database' => 'queue',
    'port' => 3306,
];

// create PDO database connection, which is required by `\Moharram82\Queue\MySQLQueue` as first parameter
try {
    $connection = new PDO(
        "mysql:host={$database_connection_options['host']};dbname={$database_connection_options['database']};port={$database_connection_options['port']};charset=utf8",
        $database_connection_options['username'],
        $database_connection_options['password'],
        [
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET character_set_results=utf8',
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET character_set_client=utf8',
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET character_set_connection=utf8',
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET collation_connection=utf8_general_ci'
        ]
    );
    $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    echo $e->getMessage();
    die;
}

// pass the connection as first optional parameter or database connection array as second optional parameter, then `\Moharram82\Queue\QueueConfig` as third optional parameter.
// keep in mind, you have to pass at least one of the first and the second parameters.
$config->setDriver(new \Moharram82\Queue\MySQLQueue($connection, [], $config));
```

- Instantiate a new `\Moharram82\Queue\QueueManager` instance

```
$manager = new \Moharram82\Queue\QueueManager($config);
```

Usage
-----

[](#usage)

### Push to Queue

[](#push-to-queue)

```
// create a Job class (which is a normal PHP class with a handle method) passing to it the object you want to process.

namespace Example;

class SendEmailJob
{
    public MailMessage $message;

    public function __construct(MailMessage $message)
    {
        $this->message = $message;
    }

    public function handle()
    {
        $this->message->send();
    }
}

$job = new \Example\SendEmailJob(new \Example\MailMessage());

// call the QueueManager instance's push method and pass to it the Job class object with an optional second parameter for the queue name.
$manager->push($job, 'default');
```

### Process the Queue

[](#process-the-queue)

```
// call the QueueManager instance's run method.
// You can call the `run` method from a cron job or supervisor process.
$manager->run('default');
```

Examples
--------

[](#examples)

Check the `example` directory for sample scripts for pushing and processing the queue.

Extending Queue
---------------

[](#extending-queue)

You can add more drivers by extending the abstract class `\Moharram82\Queue\Queue` and implementing the interface `\Moharram82\Queue\QueueInterface`

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

4

Last Release

801d ago

Major Versions

1.x-dev → 2.x-dev2024-03-07

PHP version history (2 changes)1.0.0PHP &gt;=7.4

2.x-devPHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/941c8adafc484b6bf412c588aa3a6bc6f41df4c132a78d75e6b6663df85967e9?d=identicon)[moharram82](/maintainers/moharram82)

---

Top Contributors

[![moharram82](https://avatars.githubusercontent.com/u/1148107?v=4)](https://github.com/moharram82 "moharram82 (2 commits)")

---

Tags

phpqueuemoharram82

### Embed Badge

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

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

###  Alternatives

[microsoft/azure-storage-queue

This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Queue APIs.

142.6M17](/packages/microsoft-azure-storage-queue)[renoki-co/horizon-exporter

Export Laravel Horizon metrics using this Prometheus exporter.

24152.7k](/packages/renoki-co-horizon-exporter)[webparking/laravel-queue-ensurer

This composer package provides a Laravel queue ensurer.

6416.1k](/packages/webparking-laravel-queue-ensurer)

PHPackages © 2026

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