# Migrate Laravel from Pusher: change .env, keep your events and Echo

> Move a Laravel app’s broadcasting off Pusher Channels: new .env values, Echo’s wsHost, publishing to both services during the switch with broadcastVia(), and webhooks.

Source: https://hibira.io/topics/migrate-from-pusher-laravel
Updated: 2026-11-18

A Laravel app that broadcasts through Pusher Channels can move to a Pusher-compatible service without touching its events, channel routes or Echo listeners. Laravel's `pusher` connection and Laravel Echo both take a host, so the move is a change to `.env`, a front-end rebuild and, if you want no gap at all, a short period of publishing to both services.

## What changes and what stays

| Part of your app | Changes? | What to do |
| --- | --- | --- |
| Events with `ShouldBroadcast`, `broadcastOn()` and `broadcastWith()` | No | Nothing |
| `routes/channels.php` and `/broadcasting/auth` | No | Nothing; the signatures are the same |
| Laravel Echo listeners, `toOthers()` and whispers | No | Turn on client events in the app settings if you use whispers |
| `.env` and `echo.js` | Yes | New credentials and host, then `npm run build` |
| Webhook URL | Yes | Add it on the new app; the handler stays |
| Allowed origins | New | List your domains on the app; the Free plan needs exact origins |

## Step 1: point the pusher connection at the new host

Create an app, then replace the Pusher credentials in `.env`. Laravel's `pusher` connection reads `PUSHER_HOST`, `PUSHER_PORT` and `PUSHER_SCHEME` in `config/broadcasting.php`:

```bash
BROADCAST_CONNECTION=pusher
PUSHER_APP_ID=YOUR_APP_ID
PUSHER_APP_KEY=YOUR_APP_KEY
PUSHER_APP_SECRET=YOUR_APP_SECRET
PUSHER_HOST=ws.hibira.io
PUSHER_PORT=443
PUSHER_SCHEME=https

VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
```

On Laravel 10 and earlier the variable is `BROADCAST_DRIVER`. Run `php artisan config:clear` after changing it.

## Step 2: give Echo the host and rebuild

The `echo.js` that recent Laravel versions write for Pusher already passes `wsHost`. In an older `bootstrap.js` the lines may be missing or commented out:

```js
window.Echo = new Echo({
  broadcaster: 'pusher',
  key: import.meta.env.VITE_PUSHER_APP_KEY,
  cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
  wsHost: import.meta.env.VITE_PUSHER_HOST,
  wsPort: import.meta.env.VITE_PUSHER_PORT,
  wssPort: import.meta.env.VITE_PUSHER_PORT,
  forceTLS: true,
  enabledTransports: ['ws', 'wss'],
});
```

Vite bakes these values in at build time, so run `npm run build` and deploy the new assets.

## Step 3: switch without a gap

Pages already open in browsers keep their Pusher connection until they reload. To serve both while they turn over, add the new service as a second connection and broadcast to both:

```php
// config/broadcasting.php, next to 'pusher'
'hibira' => [
    'driver' => 'pusher',
    'key' => env('HIBIRA_APP_KEY'),
    'secret' => env('HIBIRA_APP_SECRET'),
    'app_id' => env('HIBIRA_APP_ID'),
    'options' => ['host' => 'ws.hibira.io', 'port' => 443, 'scheme' => 'https', 'useTLS' => true],
],
```

```php
use Illuminate\Broadcasting\InteractsWithBroadcasting;

class OrderShipped implements ShouldBroadcast
{
    use InteractsWithBroadcasting;

    public function __construct(public Order $order)
    {
        $this->broadcastVia(['pusher', 'hibira']);
    }
}
```

In this setup `pusher` still holds the Pusher credentials and `.env`'s `VITE_` values point Echo at the new host. Once Pusher's dashboard shows no more connections, move the new credentials into `PUSHER_*` and drop the second connection. `broadcastVia()` with an array is part of Laravel's `InteractsWithBroadcasting`; see the [Laravel broadcasting docs](https://laravel.com/docs/broadcasting), checked on 2026-11-18.

## Step 4: webhooks and push notifications

Add your webhook URL on the new app. Requests carry the same `X-Pusher-Key` and `X-Pusher-Signature` headers, so the controller that verifies them stays. If you send push notifications with Pusher Beams, the [push notifications guide](https://hibira.io/guides/push-notifications) covers the Beams-compatible API.

## Or use the Laravel package

The [hibira-io/laravel](https://hibira.io/guides/laravel) package adds a `hibira` broadcast connection, writes `echo.js` for you and checks the setup with `php artisan hibira:doctor`. It is optional: the steps above work with Laravel's built-in `pusher` driver. Coming from Reverb instead? See [Laravel Echo without running Reverb](https://hibira.io/use-cases/laravel-echo).

## Questions

### Do I need to change my events or channels.php?

No. Event classes, channel names, `broadcastAs()`, `broadcastWith()` and the authorization callbacks in `routes/channels.php` stay as they are, because the auth signature and event format are the same.

### Why does Echo still connect to Pusher after I changed .env?

The `VITE_` values are compiled into your JavaScript. Run `npm run build`, deploy the new assets and hard-reload the page. Also check that `echo.js` passes `wsHost`, `wsPort` and `wssPort`.

### Do whispers and toOthers() keep working?

Yes. `toOthers()` uses the socket ID, which works the same way. Whispers are client events: turn on client events in the new app's settings, or the server refuses them.

### What about presence channels with more than 100 members?

Presence channels hold 100 members, as on Pusher. For more, Hibira's `presence-large-` channels hold up to 100,000 with a member count and a sample; see [Pusher's limits](https://hibira.io/topics/pusher-limits) for the background.
