| Package Data | |
|---|---|
| Maintainer Username: | cwt137 |
| Maintainer Contact: | cwt137@gmail.com (Christopher Thomas) |
| Package Create Date: | 2015-06-06 |
| Package Last Update: | 2015-06-09 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-29 03:01:53 |
| Package Statistics | |
|---|---|
| Total Downloads: | 744 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 5 |
| Total Watchers: | 1 |
| Total Forks: | 1 |
| Total Open Issues: | 0 |
composer require cwt137/laravel-pubnub-broadcast-driver
Add the service provider Cwt137\PubnubDriver\PubnubServiceProvider in your config/app.php file. Then in the .env file, add the following API keys:
PUBNUB_PUBLISH_KEY={YOUR_PUBNUB_PUBLISH_KEY}
PUBNUB_SUBSCRIBE_KEY={YOUR_PUBNUB_SUBSCRIBE_KEY}
Where {YOUR_PUBNUB_PUBLISH_KEY} and {YOUR_PUBNUB_SUBSCRIBE_KEY} are your PubNub publish and subscribe keys, respectively.
Next in your config/broadcasting.php file, under the connections array, add the PubNub settings:
'pubnub' => [
'driver' => 'pubnub',
'publish_key' => env('PUBNUB_PUBLISH_KEY'),
'subscribe_key' => env('PUBNUB_SUBSCRIBE_KEY'),
],
You probably want to change the defaut driver to pubnub.
You can use php artisan make:event {Name} to make a Laravel Event. Inside the event, implement the ShouldBroadcast interface by declaring a broadcastOn method. In that method you should return an array of channels you want to broadcast on.