Search by

marko / broadcasting-mercure

markshust

Mercure hub broadcasting driver for Marko Framework

Package info

github.com/marko-php/marko-broadcasting-mercure

Type:marko-module

pkg:composer/marko/broadcasting-mercure

Statistics

Installs: 3

Dependents: 0

Suggesters: 1

Stars: 0

0.11.0 2026-10-06 13:34 UTC

This package is auto-updated.

Last update: 2026-10-06 15:40:23 UTC


README

Mercure broadcasting driver --- publish realtime updates through a Mercure hub, including the one built into FrankenPHP.

Installation

composer require marko/broadcasting-mercure

This installs marko/broadcasting. You also need an HTTP client driver such as marko/http-guzzle.

Quick Example

use Marko\Broadcasting\PrivateChannel;

// Publish (BroadcasterInterface is bound to MercureBroadcaster)
$broadcaster->broadcast('shows.42', 'seat.sold', ['seat' => 'A1']);

// Let the browser subscribe, authorizing private topics via the mercureAuthorization cookie
$channels = ['shows.42', new PrivateChannel('customers.7')];
$hubUrl = $mercureSubscriberToken->subscribeUrl($channels);
$response = $mercureSubscriberToken->withAuthorizationCookie($response, $channels, $guard->user());

Documentation

Full usage, API reference, and examples: marko/broadcasting-mercure