PHPackages                             ufo-tech/rpc-mercure-transport - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ufo-tech/rpc-mercure-transport

ActiveComponent[Utility &amp; Helpers](/categories/utility)

ufo-tech/rpc-mercure-transport
==============================

Mercure transport layer for JSON-RPC event broadcasting between services.

1.1.0(3mo ago)0605↓50%MITPHPPHP ^8.3

Since Nov 20Pushed 3mo agoCompare

[ Source](https://github.com/UFO-Tech/rpc-mercure-transport)[ Packagist](https://packagist.org/packages/ufo-tech/rpc-mercure-transport)[ RSS](/packages/ufo-tech-rpc-mercure-transport/feed)WikiDiscussions main Synced 1mo ago

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

🚀 RpcMercureTransport

[![Ukraine](https://camo.githubusercontent.com/2fb547f29aac6dd78e67a73710de72477a056922508da517981e1149c7d96e4e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f476c6f72792d556b7261696e652d79656c6c6f773f6c6162656c436f6c6f723d626c7565)](https://camo.githubusercontent.com/2fb547f29aac6dd78e67a73710de72477a056922508da517981e1149c7d96e4e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f476c6f72792d556b7261696e652d79656c6c6f773f6c6162656c436f6c6f723d626c7565)

**Mercure Transport Layer for [JSON-RPC-BUNDLE](https://github.com/ufo-tech/json-rpc-bundle)**

Adds support for cross-domain events between services via [Mercure Hub](https://mercure.rocks/).

---

🧬 Idea
------

[](#-idea)

This extension for [JSON-RPC-BUNDLE](https://github.com/ufo-tech/json-rpc-bundle) allows publishing events from the RPC server to the **Mercure Hub** and receiving them by other services that are subscribed to the corresponding **topics**.

This enables building **asynchronous event-driven interaction between microservices**, without the need for RabbitMQ or other brokers.

---

[![License](https://camo.githubusercontent.com/5f10cda952d684cb9142391c760fff757740755bff79ec52769d1650f80165bb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e3f6c6162656c436f6c6f723d376238313835)](https://camo.githubusercontent.com/5f10cda952d684cb9142391c760fff757740755bff79ec52769d1650f80165bb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e3f6c6162656c436f6c6f723d376238313835)[![Size](https://camo.githubusercontent.com/54c009c214b41fe3313823a428ec10b9bf65e75165bcc58bf0052a1a91814b9d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72743f6c6162656c3d53697a652532306f662532307468652532307265706f7369746f7279)](https://camo.githubusercontent.com/54c009c214b41fe3313823a428ec10b9bf65e75165bcc58bf0052a1a91814b9d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72743f6c6162656c3d53697a652532306f662532307468652532307265706f7369746f7279)[![package_version](https://camo.githubusercontent.com/7ebd5cceeb11cd5ec7c76284e5281bafb2467199a09312df90f7c76aaaaadef1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72743f636f6c6f723d626c7565266c6162656c3d4c617465737425323056657273696f6e266c6f676f3d5061636b6167697374266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d376238313835)](https://camo.githubusercontent.com/7ebd5cceeb11cd5ec7c76284e5281bafb2467199a09312df90f7c76aaaaadef1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72743f636f6c6f723d626c7565266c6162656c3d4c617465737425323056657273696f6e266c6f676f3d5061636b6167697374266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d376238313835)[![fork](https://camo.githubusercontent.com/9ca47f44c11ef0c467c15483e35b05f1d2dcbb8897f881db44cda4d559ae1a0a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72743f636f6c6f723d677265656e266c6f676f3d676974687562267374796c653d666c6174)](https://camo.githubusercontent.com/9ca47f44c11ef0c467c15483e35b05f1d2dcbb8897f881db44cda4d559ae1a0a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72743f636f6c6f723d677265656e266c6f676f3d676974687562267374796c653d666c6174)

### Environment Requirements

[](#environment-requirements)

[![php_version](https://camo.githubusercontent.com/0000dfdda264d4a9b2e4c7ec6cc666d71d627f2de87230154ff407c9673b4d94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72742f7068703f6c6f676f3d504850266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/0000dfdda264d4a9b2e4c7ec6cc666d71d627f2de87230154ff407c9673b4d94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72742f7068703f6c6f676f3d504850266c6f676f436f6c6f723d7768697465)[![symfony mercure](https://camo.githubusercontent.com/a869f466af69b090556163ceccf2e270e5b62ef1e1a4ab6f40e3c85cd4684460/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72742f73796d666f6e792f6d6572637572652d62756e646c653f6c6162656c3d4d657263757265266c6f676f3d53796d666f6e79266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/a869f466af69b090556163ceccf2e270e5b62ef1e1a4ab6f40e3c85cd4684460/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72742f73796d666f6e792f6d6572637572652d62756e646c653f6c6162656c3d4d657263757265266c6f676f3d53796d666f6e79266c6f676f436f6c6f723d7768697465)[![ufo-tech/rpc-bundle](https://camo.githubusercontent.com/f0979065cf5c556524fa83f74d079472fd2debc9106bb453b55d1dbdac52bcf6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72742f75666f2d746563682f6a736f6e2d7270632d62756e646c653f6c6162656c3d4a736f6e52706342756e646c65266c6f676f3d75666f266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/f0979065cf5c556524fa83f74d079472fd2debc9106bb453b55d1dbdac52bcf6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f75666f2d746563682f7270632d6d6572637572652d7472616e73706f72742f75666f2d746563682f6a736f6e2d7270632d62756e646c653f6c6162656c3d4a736f6e52706342756e646c65266c6f676f3d75666f266c6f676f436f6c6f723d7768697465)

⚙️ Installation
---------------

[](#️-installation)

```
composer require ufo-tech/rpc-mercure-transport
```

---

🔧 Configuration
---------------

[](#-configuration)

`config/packages/ufo_json_rpc.yaml`:

```
ufo_json_rpc:
  #  ...
  transports:
    async:
      #  ...
      - type: 'mercure'
        config:
          name: 'rpc_socket'
          dsn: '%env(resolve:MERCURE_PUBLIC_URL)%'
          topics_prefix: 'rpc.event.'
```

---

🚀 Send a message
----------------

[](#-send-a-message)

If an `RpcSocketRequestEvent` event is dispatched in the `EventDispatcher`, the service automatically publishes it to the Mercure Hub.

The library includes syntactic sugar `Ufo\RpcMercure\Services\RpcSocketTransport::fireEvent`

```
use Ufo\RpcMercure\Services\RpcSocketTransport;

class SomeService
{
    public function __construct(
        protected RpcSocketTransport $rpcSocketTransport,
    ) {}

    public function someMethod(): void
    {
        $this->rpcSocketTransport->fireEvent(
                eventName: 'event.test',
                eventData: [
                    'someKey' => 'some value',
                ]
            ),
        );
    }
}
```

→ on the Mercure side, this event will be sent to the topic `[topics_prefix].request`.

Other services in your SOA subscribed to this topic will instantly receive messages via SSE.

---

📡 Example of subscribing to requests
------------------------------------

[](#-example-of-subscribing-to-requests)

```
php bin/console ufo:rpc:socket:consume --topic=request -v
```

```
Connect to socket: request

2025-11-19 16:09:30:
>>> {"id":"691debba4a97b","method":"event.test","jsonrpc":"2.0","params":{"$rpc":{"timeout":10,"rayId":"691debba4a97b"}}}

Service "event.test" is not found on RPC Service Map
====================================================================================================

2025-11-19 16:09:30:
>>> {"id":"691debba83412","method":"ping","jsonrpc":"2.0","params":{"$rpc":{"timeout":10,"rayId":"691debba83412"}}}
> {"id":"691debba8ef62","method":"Messenger.send","jsonrpc":"2.0","params":{"$rpc":{"timeout":10,"rayId":"691debba8ef62"}}}

Required parameter "message" not passed

```

📡 Example of subscribing to responses
-------------------------------------

[](#-example-of-subscribing-to-responses)

```
php bin/console ufo:rpc:socket:consume --topic=response -v
```

```
Connect to socket: response

2025-11-19 16:09:30:
{"id":"691debba83412","result":"PONG","jsonrpc":"2.0"}
====================================================================================================
2025-11-19 16:09:30:
{"id":"691debba8ef62","error":"Required parameter "message" not passed","jsonrpc":"2.0"}

```

---

🧠 Main idea
-----------

[](#-main-idea)

- each RPC service has its own events (domain events)
- `rpc-mercure-transport` broadcasts them to the Mercure Hub
- other services can react to them without direct dependency, just by implementing a method named after the event

---

🦠 License
---------

[](#-license)

MIT © [UFO-Tech](https://github.com/ufo-tech)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance81

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

Total

2

Last Release

99d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/87aea0bcf81c64ced7c3a14a1746d603ec6e8acfba62ef85746df40e8c376e7f?d=identicon)[Alex Maistrenko](/maintainers/Alex%20Maistrenko)

---

Top Contributors

[![Ashterix](https://avatars.githubusercontent.com/u/5172394?v=4)](https://github.com/Ashterix "Ashterix (2 commits)")

---

Tags

eventrpctransportmercurejson-rpcufo-techBroadcast

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ufo-tech-rpc-mercure-transport/health.svg)

```
[![Health](https://phpackages.com/badges/ufo-tech-rpc-mercure-transport/health.svg)](https://phpackages.com/packages/ufo-tech-rpc-mercure-transport)
```

###  Alternatives

[winzou/state-machine

A very lightweight yet powerful PHP state machine

52113.7M18](/packages/winzou-state-machine)[symfony/remote-event

Eases handling remote events

293.0M6](/packages/symfony-remote-event)[contributte/event-dispatcher

Best event dispatcher / event manager / event emitter for Nette Framework

292.4M19](/packages/contributte-event-dispatcher)[vohof/transmission

Awesome PHP JSON-RPC client library for Transmission

181.7k](/packages/vohof-transmission)

PHPackages © 2026

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