PHPackages                             slaszu/redismq - 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. slaszu/redismq

ActiveLibrary

slaszu/redismq
==============

Implementation of Pattern 'Reliable queue', using php and Redis

1.1.1(9y ago)1680MITPHPPHP &gt;=5.4

Since Feb 29Pushed 7y ago1 watchersCompare

[ Source](https://github.com/slaszu/RedisMQ)[ Packagist](https://packagist.org/packages/slaszu/redismq)[ RSS](/packages/slaszu-redismq/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

Implementation of Pattern "Reliable queue", task queue using php and Redis
==========================================================================

[](#implementation-of-pattern-reliable-queue-task-queue-using-php-and-redis)

The idea is taken from [Redis Documentation](https://redis.io/commands/rpoplpush#pattern-reliable-queue)

Install by composer
-------------------

[](#install-by-composer)

```
composer require slaszu/redismq

```

Important
---------

[](#important)

All examples you can find in tests/UsecaseTest.php

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

[](#configuration)

This library use [Predis](https://github.com/nrk/predis) to connect to Redis server. So we need predis object in examples below

```
$this->client = new \Predis\Client([
	'scheme' => 'tcp',
	'host' => REDIS_SERVER_HOST,
	'port' => REDIS_SERVER_PORT,
]);

```

Create a queue
--------------

[](#create-a-queue)

```
$queue = new \RedisMq\Queue($this->client, $name);

```

Add task (message) to queue
---------------------------

[](#add-task-message-to-queue)

```
// eg. this is message with array, but message could be a simple string either
$message = new \RedisMq\Message([
    'x' => 2,
    'string' => 'Message number 2',
    'rand' => rand(10000, 99999)
]);
$queue->addMessage($message);

```

Play with tasks
---------------

[](#play-with-tasks)

### Get list of tasks to process

[](#get-list-of-tasks-to-process)

```
$taskQty = 100;
$taskList = $queue->getTaskList($taskQty);

```

### Get task detail

[](#get-task-detail)

```
$task = $taskList->getTask();
$message = $task->getMessage();
$body = $messageArray->getBody();

//variable $body is an array given in section "Add task (message) to queue"

```

### Confirm task

[](#confirm-task)

```
$task = $taskList->getTask();

/*
 * .....
 * proccess message (task details) from task and if is all right then confirm this task
 * .....
 */

$task->confirm();

```

Task is removed from queue after confirmation.

Repair queue
------------

[](#repair-queue)

When you get TaskList from Queue, then Tasks are moved from Queue to TaskList. Task which are in TaskList not exist any longer in Queue.

In some situations you may want to move task from TaskList back to Queue. To do this use **repairTaskLists** method. This method takes one param (time in seconds). This is the minimum time that has elapsed since the creation of TaskLists. This method check all Task Lists that was created from Queue.

**Important**: if all Tasks from TaskList are confirmed, then this TaskList is empty and Redis remove this task immediately.

```
$queue = new \RedisMq\Queue($this->client, $name);
$queue->repairTaskLists(60); // 60 is time in seconds

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 79.2% 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 ~38 days

Total

4

Last Release

3608d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1758875e2dd9f976ce2bc13ee3a3ecfce76b201bd041a48255c2251fd53e2c4a?d=identicon)[slaszu](/maintainers/slaszu)

---

Top Contributors

[![pflaszaEnp](https://avatars.githubusercontent.com/u/157575435?v=4)](https://github.com/pflaszaEnp "pflaszaEnp (19 commits)")[![slaszu](https://avatars.githubusercontent.com/u/3001041?v=4)](https://github.com/slaszu "slaszu (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/slaszu-redismq/health.svg)

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

PHPackages © 2026

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