PHPackages                             stietotalwin/stw-sdk-php-redis-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. [Caching](/categories/caching)
4. /
5. stietotalwin/stw-sdk-php-redis-queue

ActiveLibrary[Caching](/categories/caching)

stietotalwin/stw-sdk-php-redis-queue
====================================

Redis Queue library for CodeIgniter framework

2.0.0(3w ago)037MITPHPPHP ^8.5

Since Jul 30Pushed 3w agoCompare

[ Source](https://github.com/stietotalwin/stw-sdk-php-redis-queue)[ Packagist](https://packagist.org/packages/stietotalwin/stw-sdk-php-redis-queue)[ RSS](/packages/stietotalwin-stw-sdk-php-redis-queue/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (12)Versions (25)Used By (0)

StieTotalWin Redis Queue
========================

[](#stietotalwin-redis-queue)

A generic Redis-based queue library for CodeIgniter 4 framework that provides reliable job processing with support for delayed jobs, retries, and failure handling.

Features
--------

[](#features)

- **Job Publishing**: Publish jobs to Redis queues with optional delays
- **Job Consumption**: Consume and process jobs from queues
- **Retry Mechanism**: Automatic retry with exponential backoff for failed jobs
- **Multiple Queues**: Support for multiple named queues
- **Queue Management**: Monitor queue statistics, clear queues, and manage jobs
- **Bulk Operations**: Publish multiple jobs at once
- **Failed Job Handling**: Track and retry failed jobs
- **Job Expiration**: Automatic cleanup of expired jobs
- **CodeIgniter 4 Integration**: Built specifically for CodeIgniter 4 framework
- **Unified Configuration**: Single Redis configuration for all operations

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

[](#requirements)

- PHP ^8.5
- CodeIgniter 4 &gt;= 4.7
- Redis server
- Predis client library

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

[](#installation)

Install via Composer:

```
composer require stietotalwin/stw-sdk-php-redis-queue:^2.0
```

Upgrading from 0.1.x to 2.0
---------------------------

[](#upgrading-from-01x-to-20)

2.0 raises the platform floor and fixes three queue-correctness bugs. There are no application API changes — `publish()`, `consume()`, `markCompleted()` and `markFailed()` keep their existing signatures.

- **PHP ^8.5 and CodeIgniter ^4.7 are now required.** All implicitly-nullable parameters were made explicit, so the library runs deprecation-free on 8.5. CodeIgniter below 4.7 pulls a `laminas/laminas-escaper` that refuses to install on PHP 8.5.
- **A job that is out of attempts is never run again.** Queue recovery previously only recognised a dead job when its stored status read `failed`. `markFailed()`sets that status on its in-memory copy only, so an interrupted terminal transition left the stored entry reading `processing` and the job was requeued on every `consume()`, forever, appending a dead-letter record each time. Recovery now decides on attempts alone.
- **`republishStuckJobs()` no longer resurrects exhausted jobs.** It incremented `attempts` with no upper bound; it now dead-letters a job that cannot retry.
- **A job can only ever be owned by one worker.** `BZPOPMIN` and the validation script are separate round-trips, so recovery could hand an in-flight job to a second worker and the same job would run twice. The script now claims the job atomically and a duplicate claim is dropped.

After upgrading, **restart your workers** — long-running consumers keep the code they started with, so a `composer update` alone changes nothing.

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

[](#configuration)

Create a configuration file `app/Config/RedisQueue.php`:

```
