Have you ever needed to update a screen automatically when some data is created or changed in the backend? For example, in notifications, chat, dashboards, or real-time orders? More and more applications need real-time communication.
With Laravel 11, the Laravel team released Reverb, a native WebSocket server that allows real-time features without using third-party services like Pusher.
In this post, I’ll show you how to set up Laravel + Reverb and build a simple example of real-time broadcasting.
🚀 What is Laravel Reverb ?
Laravel Reverb is an official WebSocket server built to work directly with Laravel. It allows you to broadcast events to users in real-time and supports public, private, and presence channels.
Reverb replaces services like Pusher or Redis + Soketi. It is a first-party solution, which means it is officially supported and fully integrated with Laravel.
Requirements
Laravel 11+
PHP 8.2+
Node.js (for Echo)
Composer
A browser that supports WebSocket
⚙️ Installing Reverb
Install the package:
composer require laravel/reverb
Publish the configuration:
php artisan vendor:publish --tag=reverb-config
Start The server:
php artisan reverb:start
Frontend with Laravel Echo
Install Laravel Echo and Socket.IO
npm install --save laravel-echo socket.io-client
In you resources/js/bootstrap.js
file or similar:
import Echo from 'laravel-echo';
import { io } from 'socket.io-client';
window.Echo = new Echo({
broadcaster: 'reverb',
host: window.location.hostname + ':6001',
client: io,
});
Creating a broadcast event
Let's create an event:
php artisan make:event NewOrderReceived
In NewOrderReceveid.php
use Illuminate\Broadcasting\Channel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class NewOrderReceived implements ShouldBroadcast
{
public function __construct(public $order) {}
public function broadcastOn(): Channel
{
return new Channel('orders');
}
}
Trigger the event:
event(new NewOrderReceived($order));
Listening to the event on the frontend
In your JavaScript:
Echo.channel('orders')
.listen('NewOrderReceived', (e) => {
console.log('New order received:', e.order);
});
Protecting private channels (optional)
If you want to use private or presence channels, use PrivateChannel
or PresenceChannel
and set up authentication using Broadcast::routes()
.
Conclusion
With Laravel Reverb, it’s much easier to build real-time features without using external services. You can use it for notifications, chat, live dashboards, or any other interactive feature.
If you are still using polling or paid services, Reverb is a great solution to try.