PHPackages                             waaseyaa/mercure - 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. waaseyaa/mercure

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

waaseyaa/mercure
================

Mercure hub publisher for real-time SSE push in Waaseyaa

v0.1.0-alpha.188(1mo ago)01.2k↓81.8%1GPL-2.0-or-laterPHPPHP &gt;=8.5

Since Mar 28Pushed 1w agoCompare

[ Source](https://github.com/waaseyaa/mercure)[ Packagist](https://packagist.org/packages/waaseyaa/mercure)[ RSS](/packages/waaseyaa-mercure/feed)WikiDiscussions main Synced 3w ago

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

waaseyaa/mercure
================

[](#waaseyaamercure)

**Layer 0 — Foundation**

Mercure hub publisher for real-time SSE push in Waaseyaa.

`MercurePublisher` POSTs JSON updates to a configured [Mercure](https://mercure.rocks) hub, minting a short-lived HS256 JWT (one-hour expiry, `publish: ['*']` claim) for each request. Publication is **best-effort**: when the hub URL or JWT secret is unconfigured, or the hub returns a non-2xx response, `publish()` returns `false` rather than throwing — so a failed broadcast never crashes the primary request, matching the framework convention for non-critical side effects. Pure side-effect utility — no entity storage, no global state.

Install
-------

[](#install)

Ships as part of `waaseyaa/framework`; consumers get it via the `core`, `cms`, or `full` metapackage. To pull it on its own:

```
composer require waaseyaa/mercure
```

Requires PHP &gt;= 8.5 and the cURL extension. `MercureServiceProvider` is auto-discovered (`extra.waaseyaa.providers`) and binds `MercurePublisher` as a container singleton, reading `config['mercure']['hub_url']` and `config['mercure']['jwt_secret']`.

Key API
-------

[](#key-api)

### `MercurePublisher` (`@api`, final)

[](#mercurepublisher-api-final)

```
public function __construct(string $hubUrl, string $jwtSecret)

// Publish $data (JSON-encoded) to $topic. Returns true on a 2xx hub
// response; false if unconfigured, on cURL failure, or non-2xx.
public function publish(string $topic, array $data): bool

// True only when both hubUrl and jwtSecret are non-empty.
public function isConfigured(): bool
```

### `MercureServiceProvider` (final, extends `Waaseyaa\Foundation\ServiceProvider\ServiceProvider`)

[](#mercureserviceprovider-final-extends-waaseyaafoundationserviceproviderserviceprovider)

Registers `MercurePublisher` as a singleton from the `mercure` config block:

```
public function register(): void
```

Usage
-----

[](#usage)

Resolve `MercurePublisher` from the container (or construct it directly) and push an update:

```
use Waaseyaa\Mercure\MercurePublisher;

$publisher = new MercurePublisher(
    hubUrl: 'https://hub.example.com/.well-known/mercure',
    jwtSecret: 'your-hub-jwt-secret',
);

if ($publisher->isConfigured()) {
    $publisher->publish('/notes/42', ['status' => 'updated']);
}
```

Because `publish()` is best-effort, you can call it unconditionally and ignore the return value in fire-and-forget paths — an unconfigured publisher simply returns `false` without side effects. Guard with `isConfigured()` (or inspect the boolean result) when you need to know whether the broadcast was actually attempted.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance96

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

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

Total

78

Last Release

41d ago

PHP version history (2 changes)v0.1.0-alpha.63PHP &gt;=8.4

v0.1.0-alpha.177PHP &gt;=8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/25d0ff572e93e3461e5180a920725d65691fd1e15e2d914b254dbbc2d6c393bd?d=identicon)[jonesrussell](/maintainers/jonesrussell)

---

Top Contributors

[![jonesrussell](https://avatars.githubusercontent.com/u/499552?v=4)](https://github.com/jonesrussell "jonesrussell (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/waaseyaa-mercure/health.svg)

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

###  Alternatives

[fetchleo/laravel-xml

Convert Eloquent models to XML, as well as normal objects.

104.2k](/packages/fetchleo-laravel-xml)

PHPackages © 2026

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