Looking to hire Laravel developers? Try LaraJobs

resonance-laravel maintained by resonance

Description
Laravel broadcasting driver + CLI for the resonance WebSocket server (Pusher-compatible).
Last update
2026/07/10 18:33 (dev-main)
License
Links
Downloads
2

Comments
comments powered by Disqus

Resonance for Laravel

Laravel broadcasting driver for Resonance — a self-hosted, Pusher-compatible WebSocket server shipped as a single static binary.

License: MIT

No Redis, no Node, no PHP extensions. The server speaks the Pusher protocol, so Laravel Echo and your existing broadcasting code work unchanged — this package just wires Laravel to it and manages the binary for you.

Requirements

  • PHP ≥ 8.1
  • Laravel (any currently supported version)

Installation

composer require resonance/resonance-laravel
php artisan resonance:install

resonance:install detects your OS and architecture (Linux x86_64/ARM64, macOS Intel/Apple Silicon, Windows), downloads the matching binary from GitHub Releases, verifies its SHA-256 checksum and drops it in ./bin.

Configuration

Switching an existing Pusher/Reverb app is environment-only — no code changes:

BROADCAST_CONNECTION=resonance

RESONANCE_APP_ID=app1
RESONANCE_KEY=my-key
RESONANCE_SECRET=my-secret
RESONANCE_HOST=127.0.0.1
RESONANCE_PORT=8080
RESONANCE_SCHEME=http        # https if TLS terminates before the server

The service provider registers both the resonance driver and the broadcasting connection automatically. Optionally publish the config:

php artisan vendor:publish --tag=resonance-config
Key Env Default
host RESONANCE_HOST 127.0.0.1 Server host
port RESONANCE_PORT 8080 Server port (WS + REST)
scheme RESONANCE_SCHEME http https behind TLS
app_id RESONANCE_APP_ID app1 Must match the server config
key / secret RESONANCE_KEY / RESONANCE_SECRET Must match the server config
bin RESONANCE_BIN base_path('bin/resonance') Binary location

Usage

Start the server (generates a resonance.toml from your config):

php artisan resonance:start
# or with a hand-written config:
php artisan resonance:start --config /etc/resonance.toml

Broadcast as usual:

broadcast(new OrderShipped($order));

Frontend via Laravel Echo (pusher-js transport):

const echo = new Echo({
    broadcaster: 'pusher',
    key: import.meta.env.VITE_RESONANCE_KEY,
    wsHost: import.meta.env.VITE_RESONANCE_HOST,
    wsPort: import.meta.env.VITE_RESONANCE_PORT,
    forceTLS: false,
    enabledTransports: ['ws', 'wss'],
});

Private channels authenticate through the standard /broadcasting/auth endpoint — nothing to change.

How it works

The package is intentionally thin: the server is Pusher-compatible, so the driver extends Laravel's own PusherBroadcaster and points it at Resonance. All the heavy lifting (connection handling, fan-out, backpressure) lives in the compiled server — your PHP app only sends signed HTTP requests to it.

License

MIT