Real-time with Laravel + Reverb: how to make your app interactive in real-time

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, …


This content originally appeared on DEV Community and was authored by Aleson França

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.


This content originally appeared on DEV Community and was authored by Aleson França


Print Share Comment Cite Upload Translate Updates
APA

Aleson França | Sciencx (2025-04-01T18:32:51+00:00) Real-time with Laravel + Reverb: how to make your app interactive in real-time. Retrieved from https://www.scien.cx/2025/04/01/real-time-with-laravel-reverb-how-to-make-your-app-interactive-in-real-time/

MLA
" » Real-time with Laravel + Reverb: how to make your app interactive in real-time." Aleson França | Sciencx - Tuesday April 1, 2025, https://www.scien.cx/2025/04/01/real-time-with-laravel-reverb-how-to-make-your-app-interactive-in-real-time/
HARVARD
Aleson França | Sciencx Tuesday April 1, 2025 » Real-time with Laravel + Reverb: how to make your app interactive in real-time., viewed ,<https://www.scien.cx/2025/04/01/real-time-with-laravel-reverb-how-to-make-your-app-interactive-in-real-time/>
VANCOUVER
Aleson França | Sciencx - » Real-time with Laravel + Reverb: how to make your app interactive in real-time. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/04/01/real-time-with-laravel-reverb-how-to-make-your-app-interactive-in-real-time/
CHICAGO
" » Real-time with Laravel + Reverb: how to make your app interactive in real-time." Aleson França | Sciencx - Accessed . https://www.scien.cx/2025/04/01/real-time-with-laravel-reverb-how-to-make-your-app-interactive-in-real-time/
IEEE
" » Real-time with Laravel + Reverb: how to make your app interactive in real-time." Aleson França | Sciencx [Online]. Available: https://www.scien.cx/2025/04/01/real-time-with-laravel-reverb-how-to-make-your-app-interactive-in-real-time/. [Accessed: ]
rf:citation
» Real-time with Laravel + Reverb: how to make your app interactive in real-time | Aleson França | Sciencx | https://www.scien.cx/2025/04/01/real-time-with-laravel-reverb-how-to-make-your-app-interactive-in-real-time/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.