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

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

keystone/queue
==============

Create and process background tasks with any queueing service

0.1.0-alpha1(9y ago)224MITPHPPHP &gt;=7.0

Since Feb 13Pushed 9y agoCompare

[ Source](https://github.com/keystonephp/queue)[ Packagist](https://packagist.org/packages/keystone/queue)[ RSS](/packages/keystone-queue/feed)WikiDiscussions master Synced 4w ago

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

Keystone Queue
==============

[](#keystone-queue)

[![Build Status](https://camo.githubusercontent.com/7a5dc43086816739a57eaaefe1db89653ac9f068d489e469fa9f6cfd54d21f75/68747470733a2f2f7472617669732d63692e6f72672f6b657973746f6e657068702f71756575652e706e67)](https://travis-ci.org/keystonephp/queue)

A PHP library to create and process background tasks with any queueing service.

Supported queue services:

- [AWS SQS](https://aws.amazon.com/sqs)
- [RabbitMQ](https://www.rabbitmq.com)

Features:

- Compatible with any queueing service via provider/publisher interfaces.
- Middleware to hook into the processing flow (inspired by [PSR-15](https://github.com/php-fig/fig-standards/tree/master/proposed/http-middleware)).
- Route task messages to workers registered as services in [PSR-11](https://github.com/container-interop/fig-standards/blob/master/proposed/container.md)/Symfony containers.

Middleware:

- Automatically close timed out Doctrine DBAL connections.
- Automatically clear the Doctrine ORM managers to free memory.
- Limit the maximum execution time of the consumer.
- Limit the maximum number of messages a consumer will process.
- Limit the maximum amount of memory a consumer is allowed to use.
- Retry failed tasks using an exponential backoff strategy.
- Handle signals to terminate the consumer process safely.

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

[](#requirements)

PHP 7.0 or above is required.

Getting started
---------------

[](#getting-started)

Install the library with Composer.

```
composer require keystone/queue
```

Create a message class for the task.

```
use Keystone\Queue\Message;

class HardMessage implements Message
{
    public $name;
    public $count;

    public function __construct(string $name, int $count)
    {
        $this->name = $name;
        $this->count = $count;
    }

    public function getKey(): string
    {
        // The message key is used to determine which queue to publish to.
        return 'hard';
    }
}
```

Create a worker class capable of processing the message.

```
class HardWorker
{
    public function process(HardMessage $message)
    {
        // Do some work to process the message.
    }
}
```

Publish a message within your application.

```
use Keystone\Queue\Publisher;

$publisher = new Publisher(...);
// The message is serialized when publishing and unserialized when consuming
$publisher->publish(new HardMessage('Billy', 12));
```

Consume the messages in a long running process.

```
use Keystone\Queue\Consumer;
use Keystone\Queue\Provider;

$provider = new Provider(...);
$consumer = new Consumer($provider, ...);
// The consumer will poll the queue for new messages and process them.
$consumer->consume();
```

Credits
-------

[](#credits)

- [Tom Graham](https://github.com/tompedals) (maintainer)
- [Mike Perham](https://github.com/mperham) for his work on [Sidekiq](https://github.com/mperham/sidekiq)
- [Henrik Bjørnskov](https://github.com/henrikbjorn) for his work on [Bernard](https://github.com/bernardphp/bernard)
- [Olivier Dolbeau](https://github.com/odolbeau) for his work on [Swarrot](https://github.com/swarrot/swarrot)

License
-------

[](#license)

Released under the MIT Licence. See the bundled LICENSE file for details.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

Unknown

Total

1

Last Release

3425d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0108faaeaf073146f428b1f04b42ba469d97bf2a9d14f31183a2b541f3de8197?d=identicon)[tompedals](/maintainers/tompedals)

---

Top Contributors

[![tompedals](https://avatars.githubusercontent.com/u/6132043?v=4)](https://github.com/tompedals "tompedals (50 commits)")

---

Tags

amqpqueuerabbitmqsqsworkerqueuerabbitmqsqsAMQPworker

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[php-amqplib/rabbitmq-bundle

Integrates php-amqplib with Symfony &amp; RabbitMq. Formerly emag-tech-labs/rabbitmq-bundle, oldsound/rabbitmq-bundle.

1.3k20.9M68](/packages/php-amqplib-rabbitmq-bundle)[enqueue/enqueue

Message Queue Library

19820.7M63](/packages/enqueue-enqueue)[swarrot/swarrot

A simple lib to consume RabbitMQ queues

3684.5M8](/packages/swarrot-swarrot)[prolic/humus-amqp

PHP-AMQP library with RabbitMQ Extensions

77210.8k5](/packages/prolic-humus-amqp)

PHPackages © 2026

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