Official package · Frameworks
Symfony UX Turbo Streams without a Mercure hub
Doctrine #[Broadcast] entities, Turbo Streams and Symfony Messenger send their updates through Hibira, and browsers receive them over WebSockets. No Mercure hub to run.
hibira-io/symfony-bundlePackagist ↗GitHub ↗
- #[Broadcast], turbo_stream_listen() and turbo_stream_from() work as they do with Mercure, with the transport named hibira.
- Every update is a Messenger message, so an async worker can send it and a slow network never slows the request.
- Signs your own private and presence channels, verifies webhooks and serves push notification tokens. Symfony 6.4, 7 and 8, UX Turbo 2 and 3.
Sign in to see these snippets with your own cluster host. Sign in
Install
composer require hibira-io/symfony-bundle # .env.local HIBIRA_APP_ID=YOUR_APP_ID HIBIRA_APP_KEY=YOUR_APP_KEY HIBIRA_APP_SECRET=YOUR_APP_SECRET php bin/console hibira:checkSet it up
use Symfony\UX\Turbo\Attribute\Broadcast; class Message { // ... }Use it
{# templates/broadcast/Message.stream.html.twig #} {% block create %} <turbo-stream action="append" target="messages"> <template>{{ include('message/_message.html.twig', { message: entity }) }}</template> </turbo-stream> {% endblock %} {# the page #} <ul id="messages" {{ turbo_stream_listen('App\\Entity\\Message') }}></ul>
Before you start
- The app secret is shown only once, when you create the app or rotate its secret. Keep it on your server, never in a browser or game build.
- On the Free plan, list every origin your pages load from in the app’s allowed origins (http://localhost:3000 while developing, then your domain). "*" needs a paid plan.
Use the app key from your dashboard; the secret stays on your server. Channels, events and authorization endpoints work exactly as they do with Pusher. Create your free account →