Home / Companies / Twilio / Blog / Post Details
Content Deep Dive

Add Realtime Push Capabilities in Symfony With Mercure

Blog post from Twilio

Post Details
Company
Date Published
Author
Joseph Udonsak
Word Count
1,658
Company Posts That Month
37
Language
English
Hacker News Points
-
Post removed?
No
Summary

A modern web application's sheer volume of data generated per second has made it inefficient for the client to simply poll the server, instead, the server should be able to send updates to the client at will. The Mercure protocol is an open protocol designed from the ground up to publish updates from server to clients, and it is a modern and efficient alternative to timer-based polling and to WebSocket. To set up a Mercure Hub for a Symfony application, you can either use Docker integration or by using the standalone binary, with two ways to set up a hub. In addition to setting up a hub, you will also learn how to dispatch and subscribe to hub updates. The prerequisites for this tutorial are a basic understanding of PHP and Symfony, PHP 8.0 or above, Composer globally installed, the Symfony CLI, and Docker desktop. To get started, create a new project and change into the new project directory, then add the project dependencies using the composer commands. While setting up the Mercure Hub, you will be able to use either Docker integration or by configuring the Mercure Hub as a static binary. Once set up, you can create a controller to test the newly set up hub, subscribe to updates from the Twig template, and run the application. The final step is to start your Symfony application and open two new tabs in your browser to test the setup with real-time push capabilities.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Real-time 3 2,216 526 161 -9%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.