Broadcast events with PubNub from your application
Integrates the PubNub service, which makes it unbelieable easy to send broadcast events from your application.
To install this package you will need:
- Laravel 5.1+
- PHP 5.5.9+
You must then modify your composer.json
file and run composer update
to include the latest version of the package in your project.
"require": {
"nodes/pubnub": "^1.0"
}
Or you can run the composer require command from your terminal.
composer require nodes/pubnub:^1.0
Setup service provider in config/app.php
Nodes\Services\Pubnub\ServiceProvider::class
Setup alias in config/app.php
'Pubnub' => Nodes\Services\Pubnub\Support\Facades\Pubnub::class
Publish config files
php artisan vendor:publish --provider="Nodes\Services\Pubnub\ServiceProvider"
If you want to overwrite any existing config files use the --force
parameter
php artisan vendor:publish --provider="Nodes\Services\Pubnub\ServiceProvider" --force
Open the config/broadcasing.php
file and the following array to the array of connections
:
'pubnub' => [
'driver' => 'pubnub',
'publish_key' => config('nodes.services.pubnub.credentials.publish_key'),
'subscribe_key' => config('nodes.services.pubnub.credentials.subscribe_key')
],
Add your PubNub application credentials to your .env
file:
BROADCAST_DRIVER=pubnub
PUBNUB_PUBLISH_KEY=YOUR-PUBLISH-KEY
PUBNUB_SUBSCRIBE_KEY=YOUR-SUBSCRIBE-KEY
PUBNUB_SECRET_KEY=YOUR-SECRET-KEY
That's it! All your events will now be broadcasted through PubNub.
This package is developed and maintained by the PHP team at Nodes
This package is open-sourced software licensed under the MIT license