Laravel SDK
emitwave/laravel — a Laravel broadcasting driver backed by Emitwave.
Server SDK· 5 min read
Install
bash
composer require emitwave/laravel
Requires PHP 8.3+, Laravel 12 or 13 broadcasting components, and emitwave/php. The service provider is auto-discovered.
Configure broadcasting
Add an Emitwave connection, then set the environment variables.
broadcasting.php
// config/broadcasting.php 'connections' => [ 'emitwave' => [ 'driver' => 'emitwave', 'gateway_url' => env('EMITWAVE_GATEWAY_URL', 'https://api.emitwave.com'), 'app_id' => env('EMITWAVE_APP_ID'), 'key' => env('EMITWAVE_KEY'), 'secret' => env('EMITWAVE_SECRET'), ], ],
.env
BROADCAST_CONNECTION=emitwave EMITWAVE_GATEWAY_URL=https://api.emitwave.com EMITWAVE_APP_ID=app_your_application_id EMITWAVE_KEY=ew_pk_live_your_public_key EMITWAVE_SECRET=your_server_secret
Keep
EMITWAVE_SECRET out of source control and browser-visible environment.Authentication boundaries
The driver only handles trusted server publishing. Private/presence authorization callbacks are evaluated by EmitWave, not by this broadcaster — calling its auth() methods raises an exception. Point browser SDKs at the EmitWave /connect-token and /channel-auth endpoints (see Authentication).
Channel types
Laravel channel names are forwarded to Emitwave without changing their external prefixes.
| Laravel target | Emitwave channel |
|---|---|
| new Channel('news') | Public |
| new PrivateChannel('account.42') | private-account.42 |
| new PresenceChannel('room.lobby') | presence-room.lobby |
Broadcast an event
Use Laravel's normal broadcasting contracts — the driver signs and publishes under the hood.
OrderCreated.php
<?php namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; class OrderCreated implements ShouldBroadcast { public function __construct(public array $order) {} public function broadcastOn(): array { return [new Channel('orders')]; } public function broadcastAs(): string { return 'order.created'; } } // Dispatch it normally OrderCreated::dispatch(['id' => 'ord_123', 'total' => 4900]);
If a PSR-18
ClientInterface is bound in the container, the driver uses it; otherwise it uses the cURL transport from emitwave/php.