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.282(1w ago)03.1k↓73.4%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 1w ago

READMEChangelogDependencies (8)Versions (173)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) for each request. The token follows **least privilege**: its `publish` claim is scoped to the exact topic being published (`publish: ['/notes/42']`), never the `['*']` wildcard — so a leaked token cannot be used to publish to any other topic. The hub URL **must** be `https://`: the token is sent as a bearer header, so a non-https hub would leak it in cleartext and is therefore treated as unconfigured (the POST also pins `CURLOPT_SSL_VERIFYPEER`/`VERIFYHOST`). Publication is **best-effort**: when the hub URL is unconfigured/non-https or the JWT secret is unset, 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 jwtSecret is non-empty and hubUrl is an https:// URL.
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

51

—

FairBetter than 95% of packages

Maintenance98

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.7% 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

172

Last Release

11d 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

[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (33 commits)")[![jonesrussell](https://avatars.githubusercontent.com/u/499552?v=4)](https://github.com/jonesrussell "jonesrussell (10 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)
```

PHPackages © 2026

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