eliuflorez/laravel-pubnub

Pubnub event broadcast driver for Laravel/Lumen

1.0 2023-07-25 17:37 UTC

This package is not auto-updated.

Last update: 2024-05-01 19:45:26 UTC


README

Integrates the Pubnub PHP library with Laravel and Lumen

Installation

composer require eliuflorez/laravel-pubnub

Laravel 9+10

Add a ServiceProvider to your providers array in config/app.php:

'providers' => [
    'PubNub\PubnubDriver\PubnubServiceProvider',
]

Lumen

For Lumen add the following in your bootstrap/app.php

$app->register(PubNub\PubnubDriver\PubnubServiceProvider::class);

Configuration

Then in the .env file, add the following API keys:

PUBNUB_PUBLISH_KEY={YOUR_PUBNUB_PUBLISH_KEY}
PUBNUB_SUBSCRIBE_KEY={YOUR_PUBNUB_SUBSCRIBE_KEY}

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 default broadcast driver to pubnub.