PHPackages                             jardisport/messaging - 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. jardisport/messaging

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

jardisport/messaging
====================

Publish/subscribe, consumer group, and message handler interfaces for multi-transport messaging

v1.0.0(2mo ago)0124↓50%2proprietaryPHPPHP &gt;=8.2CI failing

Since Mar 18Pushed 2mo agoCompare

[ Source](https://github.com/jardisPort/messaging)[ Packagist](https://packagist.org/packages/jardisport/messaging)[ Docs](https://github.com/jardisPort/messaging)[ RSS](/packages/jardisport-messaging/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (6)Used By (2)

Jardis Messaging Port
=====================

[](#jardis-messaging-port)

[![Build Status](https://github.com/jardisPort/messaging/actions/workflows/ci.yml/badge.svg)](https://github.com/jardisPort/messaging/actions/workflows/ci.yml/badge.svg)[![License: PolyForm Shield](https://camo.githubusercontent.com/d8fb46c82be4c5312bf3e372ac734dfdf6a8b328e9c2b2856af671adbb0600a5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d506f6c79466f726d253230536869656c642d626c75652e737667)](LICENSE.md)[![PHP Version](https://camo.githubusercontent.com/a68b290dcc313d698dc138a1111aa83eee2f143605449d7e8b5416ea6f88558f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e322d3737374242342e737667)](https://www.php.net/)[![PHPStan Level](https://camo.githubusercontent.com/c51bda247654363d3e30bc352674dd761a9557803a14af0226eb411d6dc0006b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230382d627269676874677265656e2e737667)](phpstan.neon)[![PSR-12](https://camo.githubusercontent.com/34b10db0caa29bacd49bda5c437a8de95385f036f3230b31fa605326e18da22c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f64652532305374796c652d5053522d2d31322d626c75652e737667)](phpcs.xml)

> Part of the **[Jardis Business Platform](https://jardis.io)** — Enterprise-grade PHP components for Domain-Driven Design

Async messaging contracts for publish/subscribe communication. Six interfaces covering high-level messaging services, low-level transport publishers and consumers, and message handler callbacks. Swap transports without touching your domain logic — Redis, Kafka, and RabbitMQ all implement the same contracts.

---

Interfaces
----------

[](#interfaces)

### **MessagingServiceInterface**

[](#messagingserviceinterface)

`JardisPort\Messaging\MessagingServiceInterface`

The unified entry point. Combines publishing and consuming in one service — the recommended type-hint for most use cases.

MethodSignatureDescription`publish``publish(string $topic, string|object|array $message, array $options = []): bool`Publish a message to a topic, channel, or queue. Throws `PublishException` on failure.`consume``consume(string $topic, MessageHandlerInterface $handler, array $options = []): void`Start consuming messages with a handler. Throws `ConsumerException` on failure.`getPublisher``getPublisher(): MessagePublisherInterface`Returns the underlying publisher instance.`getConsumer``getConsumer(): MessageConsumerInterface`Returns the underlying consumer instance.### **MessagePublisherInterface**

[](#messagepublisherinterface)

`JardisPort\Messaging\MessagePublisherInterface`

High-level publisher contract. Accepts strings, objects, and arrays as message payload — serialization is handled by the implementation.

MethodSignatureDescription`publish``publish(string $topic, string|object|array $message, array $options = []): bool`Publish a message. Arrays are encoded to JSON automatically.### **MessageConsumerInterface**

[](#messageconsumerinterface)

`JardisPort\Messaging\MessageConsumerInterface`

High-level consumer contract. Delegates message handling to a `MessageHandlerInterface`.

MethodSignatureDescription`consume``consume(string $topic, MessageHandlerInterface $handler, array $options = []): void`Start consuming from a topic. Throws `ConsumerException`.`stop``stop(): void`Stop the consumer.### **PublisherInterface**

[](#publisherinterface)

`JardisPort\Messaging\PublisherInterface`

Low-level transport publisher. Operates on already-serialized string payloads. Uses composition — holds a `ConnectionInterface` accessible via `getConnection()`.

MethodSignatureDescription`publish``publish(string $topic, string $message, array $options = []): bool`Publish a pre-serialized message.`getConnection``getConnection(): ConnectionInterface`Returns the underlying transport connection.### **ConsumerInterface**

[](#consumerinterface)

`JardisPort\Messaging\ConsumerInterface`

Low-level transport consumer. Operates with a raw callable callback. Uses composition — holds a `ConnectionInterface` accessible via `getConnection()`.

MethodSignatureDescription`consume``consume(string $topic, callable $callback, array $options = []): void`Consume messages. Callback signature: `function(string $message, array $metadata): bool`.`stop``stop(): void`Stop the consumer.`getConnection``getConnection(): ConnectionInterface`Returns the underlying transport connection.### **MessageHandlerInterface**

[](#messagehandlerinterface)

`JardisPort\Messaging\MessageHandlerInterface`

The handler contract passed to high-level consumers. Return value controls acknowledgment.

MethodSignatureDescription`handle``handle(string|array $message, array $metadata): bool`Handle a deserialized message. Return `true` to acknowledge/commit, `false` to reject/requeue.---

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

[](#installation)

```
composer require jardisport/messaging
```

Usage
-----

[](#usage)

```
use JardisPort\Messaging\MessagingServiceInterface;
use JardisPort\Messaging\MessageHandlerInterface;

// Type-hint against MessagingServiceInterface in your domain services
class OrderEventDispatcher
{
    public function __construct(
        private readonly MessagingServiceInterface $messaging,
    ) {}

    public function dispatch(array $orderEvent): void
    {
        $this->messaging->publish('orders.created', $orderEvent);
    }
}

// Implement MessageHandlerInterface to process incoming messages
class OrderCreatedHandler implements MessageHandlerInterface
{
    public function handle(string|array $message, array $metadata): bool
    {
        // Process the order event
        // Return true to acknowledge, false to requeue
        return true;
    }
}
```

Implemented by
--------------

[](#implemented-by)

- **[jardisadapter/messaging](https://github.com/jardisAdapter/messaging)** — Redis, Kafka, and RabbitMQ transport implementations with connection lifecycle management

Documentation
-------------

[](#documentation)

Full documentation, guides, and API reference:

**[jardis.io/docs/port/messaging](https://jardis.io/docs/port/messaging)**

License
-------

[](#license)

This package is licensed under the [PolyForm Shield License 1.0.0](LICENSE.md). Free for all use except building competing frameworks or developer tooling.

---

**[Jardis](https://jardis.io)** · [Documentation](https://jardis.io/docs) · [Headgent](https://headgent.com)

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance88

Actively maintained with recent releases

Popularity14

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

Total

2

Last Release

62d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e07a1b668e9e01ee6d1b85de7b3be1c2513f68aae9494b2011d1592104d5daa0?d=identicon)[jardis](/maintainers/jardis)

---

Top Contributors

[![Headgent](https://avatars.githubusercontent.com/u/245725954?v=4)](https://github.com/Headgent "Headgent (1 commits)")

---

Tags

interfacesmessagingdddHeadgentJardisPort

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jardisport-messaging/health.svg)

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

###  Alternatives

[queue-interop/queue-interop

Promoting the interoperability of MQs objects. Based on Java JMS

48130.5M87](/packages/queue-interop-queue-interop)[bunny/bunny

Performant pure-PHP AMQP (RabbitMQ) non-blocking ReactPHP library

7426.5M37](/packages/bunny-bunny)[enqueue/enqueue-bundle

Message Queue Bundle

27615.6M38](/packages/enqueue-enqueue-bundle)[enqueue/enqueue

Message Queue Library

19820.0M56](/packages/enqueue-enqueue)[enqueue/amqp-tools

Message Queue Amqp Tools

14721.1M12](/packages/enqueue-amqp-tools)[enqueue/amqp-lib

Message Queue Amqp Transport

1078.5M61](/packages/enqueue-amqp-lib)

PHPackages © 2026

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