How Can I Configure Lumen To Broadcast Events via Pusher?

- 1 answer


Lumen's docs state that "Lumen supports several broadcast drivers out of the box: Pusher, Redis, and a log driver for local development and debugging. A configuration example is included for each of these drivers. The BROADCAST_DRIVER configuration option may be used to set the default driver."

In my .env file I have set BROADCAST_DRIVER=pusher. Where/how can I configure my pusher ID, key, and secret? I see that in Laravel a configuration file for setting these options lies within config/broadcasting.php. Where can I set these options within Lumen?

Temporarily I have edited Illuminate\Broadcasting\BroadcastManager and hard coded my values in.

protected function createPusherDriver(array $config)
        // override
        $app_id = 'hidden';
        $key = 'hidden';
        $secret = 'hidden';

        return new PusherBroadcaster(
            new Pusher($key, $secret, $app_id, Arr::get($config, 'options', []))



Okay, I figured it out. Essentially you have to add in the config files yourself.

  1. Create a config directory in the root of your app.
  2. Copy config/broadcasting.php from a working laravel installation into this directory
  3. Add the following keys to your .env file: PUSHER_SECRET, PUSHER_KEY, PUSHER_APP_ID