Build Real-time Apps in PHP using WebSockets, Laravel and Twilio Sync
Twilio Sync is a powerful API which allows us at Momentum, an online travel agency, to keep our dashboards up to date with its WebSockets entities. Pairing it with Laravel’s Broadcasting feature, however, gave us the ability to efficiently dispatch, queue, serialize and log our Twilio Sync calls from Laravel. In this post, I will walk you through how you can extend Laravel’s framework to make use of Twilio Sync natively.
Additionally, from this tutorial we will:
- Learn about Twilio Sync Streams
- Implement Twilio as a Service Container within Laravel
- Creating a Driver for Laravel’s
- Create a REST API for Twilio callbacks
Require the Twilio SDK
First, we will need a Laravel project. Version 5 is recommended. For this walkthrough, I will be using the latest version available (at the time of writing, 5.7). If you're using Valet or are comfortable with command line installs, run ...