bellal/laravel-pubnub

Broadcast events with PubNub in your Laravel project

1.1.0 2019-07-28 14:41 UTC

This package is auto-updated.

Last update: 2024-04-29 01:32:48 UTC


README

Broadcast events with PubNub from your application

📝 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.

Or you can run the composer require command from your terminal.

🔧 Setup

Setup service provider in config/app.php

Bellal\Services\Pubnub\ServiceProvider::class

Setup alias in config/app.php

'Pubnub' => Bellal\Services\Pubnub\Support\Facades\Pubnub::class

Publish config files

php artisan vendor:publish --provider="Bellal\Services\Pubnub\ServiceProvider"

If you want to overwrite any existing config files use the --force parameter

php artisan vendor:publish --provider="Bellal\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' => env('PUBNUB_PUBLISH_KEY'),
    'subscribe_key' => env('PUBNUB_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

That's it! All your events will now be broadcasted through PubNub.

🏆 Credits

📄 License

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