/pubnub

Broadcast events with PubNub in your Laravel project.

Primary LanguagePHPMIT LicenseMIT

PubNub

Broadcast events with PubNub from your application

Total downloads Monthly downloads Latest release Open issues License Star repository on GitHub Watch repository on GitHub Fork repository on GitHub

📝 Introduction

Integrates the PubNub service, which makes it unbelieable easy to send broadcast events from your application.

📦 Installation

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

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

⚙ Usage

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.

🏆 Credits

This package is developed and maintained by the PHP team at Nodes

Follow Nodes PHP on Twitter Tweet Nodes PHP

📄 License

This package is open-sourced software licensed under the MIT license