Laravel Reverb

Laravel Reverb

A first-party WebSocket server designed to bring real-time communication capabilities to Laravel applications

INSTALLATION
$composer require laravel/reverb

Laravel Reverb is a first-party WebSocket server designed to bring real-time communication capabilities to Laravel applications. It seamlessly integrates with Laravel's event broadcasting system, allowing developers to implement features like live updates and interactive user experiences without relying on third-party services.

What is Laravel Reverb? #

Laravel Reverb is Laravel's WebSocket server that provides:

  • Real-time communication
  • Laravel Broadcasting integration
  • Laravel Echo support
  • Pusher protocol compatible

Key Features #

WebSocket Server: Powerful and optimized WebSocket server ✅ Laravel Broadcasting Integration: Works seamlessly with Laravel's broadcasting system ✅ Laravel Echo Compatible: Perfect integration with Laravel Echo ✅ Pusher Protocol: Uses Pusher protocol for full compatibility ✅ Easy Setup: Simple and quick installation

Key Features

1

WebSocket Server

Powerful and optimized WebSocket server designed specifically for Laravel applications

2

Laravel Broadcasting Integration

Seamlessly integrates with Laravel's event broadcasting system

3

Laravel Echo Compatible

Works perfectly with Laravel Echo for easy frontend integration

4

Pusher Protocol

Uses Pusher protocol for full compatibility with existing tools

Installation

1

Install Reverb

CODE
php artisan install:broadcasting
2

Configure environment variables

CODE
REVERB_APP_ID=my-app-id
REVERB_APP_KEY=my-app-key
REVERB_APP_SECRET=my-app-secret
3

Start Reverb server

CODE
php artisan reverb:start

Usage

1

Broadcast an event

Broadcast an event from Laravel

CODE
broadcast(new OrderShipped($order));
2

Listen in frontend

Using Laravel Echo to listen

CODE
Echo.channel('orders')
    .listen('OrderShipped', (e) => {
        console.log(e.order);
    });

Security Notes

Ensure SSL is properly configured for production.

Set allowed origins carefully to avoid CORS issues.

Use proper authentication for connections.

Alternatives

Pusher

Ably

Socket.io