laravel/reverb
Laravel Reverb adds real-time WebSocket support to Laravel, enabling broadcasting and live updates with a first-party, self-hosted server and seamless Laravel integration. Ideal for chat, notifications, and presence features.
Laravel Reverb is a native replacement for Pusher in Laravel applications, leveraging WebSockets for real-time communication. It integrates seamlessly with Laravel’s existing broadcasting infrastructure, making it ideal for:
The package replaces the dependency on Pusher’s cloud service, reducing vendor lock-in and operational costs while maintaining compatibility with Laravel’s Broadcast facade and event-driven architecture.
Key architectural strengths:
✅ Laravel-first design – Built for Laravel’s ecosystem (Laravel 12/13 support, Prompts integration).
✅ Redis-backed – Scales horizontally with Redis Pub/Sub, enabling distributed WebSocket handling.
✅ Pusher API compatibility – Supports Pusher’s HTTP API (e.g., pusher:subscribe), easing migration.
✅ Modular – Supports custom channel authorization, rate limiting, and connection limits.
Potential misfits: ⚠ Monolithic Laravel dependency – Not suitable for non-Laravel PHP apps (e.g., Symfony, standalone Lumen). ⚠ Redis requirement – Adds operational complexity if Redis isn’t already in use. ⚠ WebSocket-only – No fallback to HTTP long-polling (unlike Pusher), which may impact legacy browser support.
Reverb is designed for drop-in replacement of Pusher in Laravel apps. The integration path is straightforward for teams already using Laravel’s broadcasting system.
Prerequisites:
Key integration points:
config/broadcasting.php):
'pusher' => [
'driver' => 'reverb',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'host' => env('REVERB_HOST', '127.0.0.1'),
'port' => env('REVERB_PORT', 6001),
'scheme' => env('REVERB_SCHEME', 'http'),
'datacenter' => false,
'use_tls' => env('REVERB_SCHEME') === 'https',
'activity_timeout' => 60,
'heartbeat' => 10,
],
],
reverb:install Artisan command):
composer require laravel/reverb
php artisan reverb:install
Pusher with Reverb (or keep using Pusher JS with Reverb’s HTTP API).import Reverb from 'laravel-reverb';
const reverb = new Reverb({
key: process.env.MIX_PUSHER_APP_KEY,
wsHost: window.location.hostname,
wsPort: 6001,
forceTLS: window.location.protocol === 'https:',
enabledTransports: ['ws', 'wss'],
});
Compatibility with existing Laravel features:
Event system (e.g., broadcast(new MessageSent($message))).BroadcastsOn trait.App\Models\User::class).| Risk Area | Assessment | Mitigation |
|---|---|---|
| Redis dependency | Critical for pub/sub and scaling. Downtime or misconfiguration can disrupt real-time features. | Use Redis Cluster for HA; monitor Redis health via Laravel Horizon or Prometheus. |
| WebSocket protocol | Browser/OS-level WebSocket limitations (e.g., CORS, NAT traversal). | Configure allowed_origins in Reverb; use STOMP over WebSocket for complex cases. |
| Migration complexity | Replacing Pusher may require client-side SDK updates or proxying. | Test with a staging environment; use Pusher’s HTTP API as a fallback during transition. |
| Performance bottlenecks | High connection counts may stress Redis or PHP workers. | Enable connection limits (max_connections); use Laravel Horizon for queue scaling. |
| Security | WebSocket auth relies on Laravel’s auth system; misconfigurations may expose channels. | Audit BroadcastServiceProvider; use BroadcastWhen to restrict channel access. |
| Monitoring | Limited native observability (vs. Pusher’s dashboards). | Integrate with Laravel Telescope or Prometheus for metrics (e.g., connections, messages). |
Critical questions for stakeholders:
Reverb is optimized for Laravel’s stack and integrates cleanly with:
laravel/reverb image), Kubernetes (horizontal scaling), or Laravel Forge.Non-Laravel compatibility:
| Phase | Actions | Tools/Dependencies |
|---|---|---|
| Pre-migration | Audit Pusher usage (HTTP API vs. WebSocket). | php artisan route:list + code search. |
| Pilot Environment | Install Reverb in staging; test with a subset of features. | composer require laravel/reverb, php artisan reverb:install. |
| Client-Side Update | Replace Pusher JS with Reverb config or proxy Pusher requests to Reverb’s HTTP API. | Laravel Echo, Pusher JS SDK. |
| Broadcasting Update | Update config/broadcasting.php; test events/channels. |
Laravel Telescope for debugging. |
| Load Testing | Simulate production traffic; monitor Redis/PHP worker performance. | k6, Artisan commands, or Laravel Dusk. |
| Rollout | Gradual switch (e.g., feature flags for WebSocket endpoints). | Feature management (e.g., Laravel Nova). |
| Monitoring | Set up alerts for WebSocket errors, Redis latency, or connection drops. | Laravel Telescope, Prometheus, or Datadog. |
Rollback Plan:
| Feature | Reverb Support | Notes |
|---|---|---|
| Pusher JS SDK | ✅ (with config tweaks) | Update wsHost, wsPort, and wsScheme. |
| Pusher HTTP API | ✅ (partial) | Supports pusher:subscribe but may need proxying for other endpoints. |
| Private Channels | ✅ | Uses Laravel’s auth system (e.g., BroadcastsOn). |
| Presence Channels | ✅ | Full support with App\Models\User::class. |
| Server-Sent Events (SSE) | ❌ | Not supported; use WebSockets exclusively. |
| Cluster Mode | ✅ | Redis Cluster + multiple Reverb instances. |
| Rate Limiting | ✅ (v1.9+) | Configure rate_limits in config/broadcasting.php. |
| Custom Auth |
How can I help you explore Laravel packages today?