Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Mercure Broadcaster

Laravel Mercure Broadcaster Laravel Package

mvanduijker/laravel-mercure-broadcaster

A Laravel broadcaster that sends your app's events to a Mercure hub for real-time updates over Server-Sent Events. Skip Pusher and websockets: publish model changes and notifications to browsers with a simple, lightweight setup that plugs into Laravel's existing broadcasting system.

View on GitHub
Deep Wiki
Context7

Mercure broadcaster

Frequently asked questions about Laravel Mercure Broadcaster
How do I install and configure mvanduijker/laravel-mercure-broadcaster?
Install it with Composer, publish the package config, and set BROADCAST_CONNECTION=mercure in your environment. You then supply the Mercure hub URL, the public hub URL, and the JWT secret used for publishing. The server-side setup is intentionally close to trivial because the package registers a broadcast driver inside Laravel's existing broadcasting system.
Does laravel-mercure-broadcaster support Laravel 13?
Version 3.9.0 is a Laravel 13.x compatibility release produced with Laravel Shift, so it removes that framework version as an upgrade blocker. It is a routine forward-compatibility bump with no new features, config changes, deprecations, or breaking changes. The release does not establish a broader support matrix beyond that compatibility update, so confirm your exact Laravel and PHP versions before rollout.
Do I need Laravel Echo to use Mercure with Laravel?
Laravel Echo does not have a first-party Mercure connector, so the client side needs separate wiring. You can use the Mercure JavaScript library or raw EventSource, plus an endpoint that mints subscriber JWTs for private subscriptions. Treat that front-end work as a bespoke workstream rather than a simple configuration change.
How do private Mercure channels and JWT authentication work in Laravel?
Private updates depend on correctly signing JWTs with the Mercure subscribe and publish claims. Publishing uses the hub credentials configured for the broadcaster, while private client subscriptions need an authorization endpoint that issues scoped subscriber tokens. Misconfiguration can fail open or closed silently depending on hub settings, so add an explicit test for private-channel auth.
Is Mercure a replacement for Pusher, Ably, or Reverb in Laravel?
Mercure can replace Pusher, Ably, or Reverb when your real-time needs are one-way server-to-client fan-out over Server-Sent Events. It plugs into Laravel's broadcast abstraction, so broadcast events and ShouldBroadcast classes flow through the same channels and queue plumbing. It is not a good fit if you need bidirectional client-to-server messaging, because SSE is one-way by design.
What Mercure hub do I need to run for this Laravel broadcaster?
You need to operate a Mercure hub such as Caddy with the Mercure module or FrankenPHP. That adds a stateful service to your stack and shifts real-time transport from WebSockets to Server-Sent Events over HTTP/2. Your edge must support HTTP/2 and must not buffer text/event-stream responses.
How does laravel-mercure-broadcaster handle queues and ShouldBroadcast events?
The package registers a mercure broadcast driver, so existing ShouldBroadcast events, channels, and queue plumbing continue to work as they do with Pusher or Reverb. It is an adapter into Laravel's broadcasting layer rather than a separate platform. That makes it a small change on the server side if your application already broadcasts domain events.
Can I test Mercure broadcasting in Laravel without a production hub?
Yes, stand up a non-production Mercure hub with a self-signed JWT and validate the publish path first. A practical smoke test is to dispatch a test event from php artisan tinker and confirm it reaches the hub. Then build and test the subscriber side, including the private-subscription JWT endpoint, before prototyping on a low-risk feature.
What are the risks of using a single-maintainer Laravel Mercure package?
The main risk is concentration: this is a narrow, single-maintainer package rather than a broad platform. That risk is mitigated by the package's small scope, since the alternative is roughly 200 lines of custom broadcaster code, so forking or vendoring it is realistic if maintenance lapses. Hub major upgrades are a more likely breakage vector than routine package releases because Mercure defines the JWT claim model and topic conventions.
How do I migrate from Pusher to Mercure in a Laravel app?
Keep your existing driver in place and add mercure as a second connection in config/broadcasting.php, then validate the publish path against a non-production hub. Build the subscriber authorization endpoint and front-end EventSource wiring, then prototype on one low-risk feature. Cut over per feature behind a flag so rollback is a configuration toggle rather than a full deploy.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections