unoapp-dev/laravel-pubnub

Laravel/Lumen的Pubnub事件广播驱动程序

1.0.1 2019-04-16 09:32 UTC

This package is auto-updated.

Last update: 2024-09-16 21:28:24 UTC


README

整合了Pubnub PHP库到Laravel和Lumen中

安装

composer require unoapp-dev/laravel-pubnub

Laravel 5

config/app.php中将ServiceProvider添加到providers数组中

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

Lumen

对于Lumen,在bootstrap/app.php中添加以下内容

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

配置

然后在.env文件中,添加以下API密钥

PUBNUB_PUBLISH_KEY={YOUR_PUBNUB_PUBLISH_KEY}
PUBNUB_SUBSCRIBE_KEY={YOUR_PUBNUB_SUBSCRIBE_KEY}

接下来在config/broadcasting.php文件中,在connections数组下,添加PubNub设置

'pubnub' => [
    'driver' => 'pubnub',
    'publish_key' => env('PUBNUB_PUBLISH_KEY'),
    'subscribe_key' => env('PUBNUB_SUBSCRIBE_KEY'),
],

你可能想要将默认的广播驱动程序更改为pubnub