PHPackages                             efabrica/hermes-extension - 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. efabrica/hermes-extension

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

efabrica/hermes-extension
=========================

Extension for tomaj/hermes

2.1.0(7mo ago)170.2k↓12.5%5[2 PRs](https://github.com/efabrica-team/hermes-extension/pulls)MITPHPPHP ^7.4 | ^8.0

Since May 13Pushed 7mo ago3 watchersCompare

[ Source](https://github.com/efabrica-team/hermes-extension)[ Packagist](https://packagist.org/packages/efabrica/hermes-extension)[ RSS](/packages/efabrica-hermes-extension/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (15)Used By (0)

Hermes extension
================

[](#hermes-extension)

[![PHPStan level](https://camo.githubusercontent.com/8eff2a8ac302a6e989418c7e571870ff5d8fe9db395c6bc3381d1052856a7751/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c3a2532306d61782d627269676874677265656e2e737667)](https://github.com/efabrica-team/hermes-extension/actions?query=workflow%3A%22PHP+static+analysis%22)[![PHP static analysis](https://github.com/efabrica-team/hermes-extension/workflows/PHP%20static%20analysis/badge.svg)](https://github.com/efabrica-team/hermes-extension/actions?query=workflow%3A%22PHP+static+analysis%22)[![Latest Stable Version](https://camo.githubusercontent.com/50c87adf3ce8329c7ef5adc373d05e0998da1420edad6b06103ecbf4d2eb5a7a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65666162726963612f6865726d65732d657874656e73696f6e2e737667)](https://packagist.org/packages/efabrica/hermes-extension)[![Total Downloads](https://camo.githubusercontent.com/6ed6d89f49f0dc32a1e58f9c02357a51343a47231d308c41123e4bcbfccaca06/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f65666162726963612f6865726d65732d657874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/efabrica/hermes-extension)

Extension for tomaj/hermes. It contains:

- `HermesWorker` (symfony command)
- Drivers (`RedisProxy` based):
    - `RedisProxySetDriver`
    - `RedisProxySortedSetDriver`
    - `RedisProxyListDriver`
    - `RedisProxyStreamDriver`
- Other drivers:
    - `DummyDriver` (for testing purposes)
- Heartbeat functionality with drivers
    - `RedisProxyStorage`
    - `MemoryStorage` (for testing purposes)

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

[](#installation)

```
composer require efabrica/hermes-extension
```

Quick setup
-----------

[](#quick-setup)

```
use Efabrica\HermesExtension\Driver\RedisProxySetDriver;
use Efabrica\HermesExtension\Heartbeat\RedisProxyStorage;
use RedisProxy\RedisProxy;
use Tomaj\Hermes\Dispatcher;
use Tomaj\Hermes\Handler\EchoHandler;
use Tomaj\Hermes\Shutdown\SharedFileShutdown;

$redisProxy = new RedisProxy(/*...*/);

// Register driver
$driver = new RedisProxySetDriver($redisProxy, 'hermes');

// Optionally register shutdown and / or heartbeat
$driver->setShutdown(new SharedFileShutdown('/tmp/hermes_shared_file'));
$driver->setHeartbeat(new RedisProxyStorage($redisProxy, 'hermes_heartbeat'));

// Create Dispatcher
$dispatcher = new Dispatcher($driver);

// Register handlers
$dispatcher->registerHandler('event_type', new EchoHandler());
```

Register hermes worker to symfony console application:

```
// file: bin/command

use Efabrica\HermesExtension\Command\HermesWorker;
use Symfony\Component\Console\Application;

$application = new Application();
$application->add(new HermesWorker($dispatcher));
$application->run();
```

Run command:

```
php bin/command hermes:worker
```

Submit message:

```
use Tomaj\Hermes\Emitter;
use Tomaj\Hermes\Message;

// Create Emitter
$emitter = new Emitter($driver);

// Send message:
$emitter->emit(new Message(
    'event_type',
    ['body' => 'This is a message!']
));
```

`RedisProxy` drivers
--------------------

[](#redisproxy-drivers)

**Common driver properties:**

- can define one (default) or more priority queues
- can have shutdown functionality defined to stop their work
- can have heartbeat functionality defined to track activity
- can be stopped automatically after processing a given number of messages
- can be stopped by system signals (`SIGTERM`, `SIGINT`, `SIGQUIT` and `SIGHUP`)
- can be configured to fork before message handler execution (handler runs in child process) \[**POSIX systems only**\]
- handlers executed by drivers can access the message data using the `HermesDriverAccessor` singleton class

### `RedisProxySetDriver`

[](#redisproxysetdriver)

- Simple driver that uses Redis set(s) to deliver/process messages.
- This driver can't use delayed execution.
- A message acquired by the `Dispatcher` is immediately taken out of the queue and possibly lost when the dispatcher crashes or is force-stopped.
- There is no real-time monitoring.

### `RedisProxySortedSetDriver`

[](#redisproxysortedsetdriver)

- Simple driver that uses Redis sorted set(s) to deliver/process messages.
- This driver can use delayed execution (message is executed after the `executeAt` timestamp at any moment). The message's priority is lost in this process; a message that moves from the delayed queue to the processing queue will have default priority assigned.
- A message acquired by the `Dispatcher` is immediately taken out of the queue and possibly lost when the dispatcher crashes or is force-stopped. There is a small but real chance that a delayed message may be lost if the process is force-stopped.
- There is no real-time monitoring.

### `RedisProxyListDriver`

[](#redisproxylistdriver)

- More complex driver that uses Redis list(s) to deliver/process messages.
- This driver can't use delayed execution.
- If message reliability is enabled, the messages are re-queued when the dispatcher crashes or is force-stopped. Otherwise, messages can be lost in these cases.
- If message reliability is enabled, on **POSIX-enabled systems** (loaded `pcntl` and `posix` extensions), the message is monitored by a background heartbeat process (notifying that work is being done on the message approximately every 1 second). If the system is not POSIX-enabled, message processing can still be tracked by using `HermesDriverAccessor`. Notifications from heartbeat or `HermesDriverAccessor` reset the message processing timer. Each message gets processing protection by the monitor for a given `keepAliveTTL`; when this protection expires, the message is re-queued.
- If priorities are defined, this driver has different behavior among the other `RedisProxy` drivers. The messages are processed from highest to lowest priority, but the driver continues to take messages from the current priority level without returning to the high priority first. This default behavior can be changed to match the behavior that other drivers use by calling `setUseTopPriorityFallback(true)` on the driver object during driver setup.
- If message reliability is enabled, the message can be duplicated in some circumstances. The user has to implement custom message completion tracking if the message has to be processed only once.

### `RedisProxyStreamDriver`

[](#redisproxystreamdriver)

- More complex driver that uses Redis stream(s) to deliver/process messages.
- This driver can use delayed execution (message is executed after the `executeAt` timestamp at any moment). This driver preserves the message priority through the delayed queue; a message moved to the processing queue retains its original priority.
- The driver registers a consumer inside Redis streams. Due to this, the driver is always monitored. Monitoring is almost identical to the monitoring implemented in `RedisProxyListDriver` (when reliability is turned on). Monitoring here monitors not only messages but the consumers too, clearing outdated consumers from Redis memory. A message that is held in the stream group pending list for more than `keepAliveTTL` is claimed by the next consumer (keeps priority order). Message claiming by another consumer after `keepAliveTTL` protection expires can be restricted to a number of reclaims (defaults to 3); this can be set to 0 to throw the message away. Claimed message is processed immediately, not re-queued for later processing.
- A message can be duplicated in some circumstances. The user has to implement custom message completion tracking if the message has to be processed only once.

`HermesDriverAccessor`
----------------------

[](#hermesdriveraccessor)

- Singleton object that carries the message/stream message envelope and priority of the message.
- If a handler is executed by a dispatcher with RedisProxyListDriver (in reliability mode only) or RedisProxyStreamDriver (always), user code can call:
    - `signalProcessingUpdate()` - manual monitor notification (resets protection expiration to `keepAliveTTL`),
    - `setProcessingStatus($status, $percent)` - manual monitor notification with status or percentage of completion of the task set to the monitor, both values are optional.
- User code cannot call setters or clear the data of the `HermesDriverAccessor`.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance63

Regular maintenance activity

Popularity34

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~66 days

Total

12

Last Release

229d ago

Major Versions

0.3.1 → 1.0.02023-09-06

1.3.1 → 2.0.02025-06-24

PHP version history (3 changes)0.1.0PHP &gt;= 7.4 &lt; 8.2

0.3.1PHP &gt;= 7.4 &lt; 8.3

1.1.0PHP ^7.4 | ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/25289c62a88df1c404543693ba52e44748dbce486bcfab91fc8c5931a6bb38e1?d=identicon)[dev-efabrica](/maintainers/dev-efabrica)

---

Top Contributors

[![lulco](https://avatars.githubusercontent.com/u/9377319?v=4)](https://github.com/lulco "lulco (15 commits)")[![ricco24](https://avatars.githubusercontent.com/u/1409647?v=4)](https://github.com/ricco24 "ricco24 (6 commits)")[![andrejjursa](https://avatars.githubusercontent.com/u/2331773?v=4)](https://github.com/andrejjursa "andrejjursa (4 commits)")[![riki137](https://avatars.githubusercontent.com/u/1223388?v=4)](https://github.com/riki137 "riki137 (2 commits)")[![Martin-Beranek](https://avatars.githubusercontent.com/u/89643709?v=4)](https://github.com/Martin-Beranek "Martin-Beranek (2 commits)")[![propolis12](https://avatars.githubusercontent.com/u/68695522?v=4)](https://github.com/propolis12 "propolis12 (1 commits)")[![KavajNaruj](https://avatars.githubusercontent.com/u/22551250?v=4)](https://github.com/KavajNaruj "KavajNaruj (1 commits)")[![dev-efabrica](https://avatars.githubusercontent.com/u/12064982?v=4)](https://github.com/dev-efabrica "dev-efabrica (1 commits)")

---

Tags

driverworkerheartbeatredis-proxy

### Embed Badge

![Health badge](/badges/efabrica-hermes-extension/health.svg)

```
[![Health](https://phpackages.com/badges/efabrica-hermes-extension/health.svg)](https://phpackages.com/packages/efabrica-hermes-extension)
```

###  Alternatives

[swarrot/swarrot

A simple lib to consume RabbitMQ queues

3654.4M8](/packages/swarrot-swarrot)[dusterio/laravel-aws-worker

Run Laravel (or Lumen) tasks and queue listeners inside of AWS Elastic Beanstalk workers

3105.7M](/packages/dusterio-laravel-aws-worker)[clue/mq-react

Mini Queue, the lightweight in-memory message queue to concurrently do many (but not too many) things at once, built on top of ReactPHP

144691.7k4](/packages/clue-mq-react)[qxsch/worker-pool

Runs tasks in a parallel processing workerpool.

108325.7k1](/packages/qxsch-worker-pool)[iron-io/iron_worker

Client library for IronWorker (multi-language worker platform that runs tasks in the background, in parallel, and at scale.)

57208.5k1](/packages/iron-io-iron-worker)[yidas/codeigniter-queue-worker

CodeIgniter 3 Queue Worker Management Controller

9665.2k2](/packages/yidas-codeigniter-queue-worker)

PHPackages © 2026

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