PHPackages                             rpq/client - 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. rpq/client

ActiveLibrary

rpq/client
==========

Redis Priority Queue Client implementation in pure PHP

0.1.2(7y ago)01.6k21BSD-3-ClausePHPPHP ^7.1

Since Mar 13Pushed 7y ago1 watchersCompare

[ Source](https://github.com/charlesportwoodii/rpq-client)[ Packagist](https://packagist.org/packages/rpq/client)[ RSS](/packages/rpq-client/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (4)Used By (1)

Redis Priority Queue Client
===========================

[](#redis-priority-queue-client)

[![Travis CI](https://camo.githubusercontent.com/a124272a9805d45890ff029f081c47c4a445bbc0e1fc03eab2f8c681436be017/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636861726c6573706f7274776f6f6469692f7270712d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.com/charlesportwoodii/rpq-client)

RPQ-Client is a priority task queue implementation in Redis written in pure PHP. This repository contains the Client codebase which can be used to schedule jobs from applications. Additionally, this codebase is used by the [RPQ Server](https://github.com/charlesportwoodii/rqp-server) implementation to work with and process jobs.

> Note that this codebase is constantly evolving. Until a tagged release is made, the API may change at any time.

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

[](#installation)

RPQ-Client can be added to your application via [Composer](https://getcomposer.org/).

```
composer require rpq/client

```

> Note that RPQ-Client requires [PHPRedis](https://github.com/phpredis/phpredis).

Usage
-----

[](#usage)

The RPQ Client comes with several options to instantiate the queue. To begin using the RPQ client, connect to your Redis instance, then pass that Redis instance to the `RPQ\Client` object.

```
// Create a new Redis instance
$redis = new \Redis();
$redis->connect('127.0.0.1', 6379);

// Create a new client object
$client = new RQP\Client($redis);
//$rpq = new RPQ\Client($redis, 'namespace');

// Returns the queue object for interaction
$queue = $client->getQueue();
// $queue = $client->getQueue('another-queue-name');
```

### Adding Jobs

[](#adding-jobs)

Jobs can be scheduled for immediate execution simply by pushing a Fully Qualified Class Name to the queue.

```
// Push a new task called `Ping` to the priority queue with the default priority
$queue->push('Ping');
```

Job arguments can be a complex array. As long as the details are JSON serializable, it can be passed to RPQ. Jobs have a default priority of `1`. Jobs with a higher priority will execute before jobs with a lower priority. The priority may range from `PHP_INT_MIN` to `PHP_INT_MAX`.

Retries may either be defined as a `boolean` or as an `integer`. If `retry` is set to `true`, the job will be continuously rescheduled until it passes. If `retry` is set to `false`, no attempt will be made to retry the job. If `retry` is set to an integer, *exactly* `n` retries will be attempted, after which the job will be failed.

After pushing a job onto the stack, the `push` method will return a `Job` instance which can be used to determine the status and other information of the job.

```
// Alternatively, we can specify args, the queue name, a different priority, and whether or not RQP-Server should attempt to retry the job if it fails.
$args = [
    'arg1',
    'arg2' => [
        'stuff' => 1,
        'more' => false,
        'foo' => 'bar'
    ],
    'arg3' => true
];
$retry = true;
$priority = 3;

// Push a new task onto the priority queue, get a UUIDv4 JobID back in response
$job = $queue->push('Worker', $args, $retry, $priority);
```

> Note that complex Objects should *NOT* be passed as an arguement. If you need to access a complex object, you should re-instantiate it within your job class.

#### Future Scheduling

[](#future-scheduling)

Jobs may be scheduled in the future by specifying the `at` parameter, which represents a unix timestamp of the time you wish for the job to execute at.

```
$at = \strtotime('+1 hour');

$job = $queue->push('Worker', $args, $retry, $priority, $at);
```

> Note that the `at` parameter declares the *earliest* a job will execute, and does not guarantee that a job will execute at that time. The scheduler will prioritize future jobs when possible, but other jobs may have priority over it depending upon the priority. If you require exact timining, the job should have a priority of `PHP_MAX_INT`, and you should ensure that your job queue has sufficient workers to prevent the job execution from being delayed.

### Queue Statistics

[](#queue-statistics)

Details about the queue can be retrieved as follows:

```
$queue->getStats()->get();
```

The stats command will return an array containing the number of elements in the queue, and details about the passed, failed, canceled, and retried jobs for the given day.

To retrieve stats for a different day, call `get()` with a `Y-m-d` formatted date.

### Job Details

[](#job-details)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

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 ~180 days

Total

3

Last Release

2624d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/630969?v=4)[Charles R. Portwood II](/maintainers/charlesportwoodii)[@charlesportwoodii](https://github.com/charlesportwoodii)

---

Top Contributors

[![charlesportwoodii](https://avatars.githubusercontent.com/u/630969?v=4)](https://github.com/charlesportwoodii "charlesportwoodii (33 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rpq-client/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[stancl/tenancy

Automatic multi-tenancy for your Laravel application.

4.3k6.6M40](/packages/stancl-tenancy)[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k12.2M45](/packages/knuckleswtf-scribe)[google/cloud

Google Cloud Client Library

1.2k16.2M53](/packages/google-cloud)

PHPackages © 2026

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