eliuflorez / laravel-pubnub
为Laravel/Lumen提供的Pubnub事件广播驱动程序
1.0
2023-07-25 17:37 UTC
Requires
- pubnub/pubnub: ^6.0
This package is not auto-updated.
Last update: 2024-09-18 21:31:40 UTC
README
将Pubnub PHP库与Laravel和Lumen集成
安装
composer require eliuflorez/laravel-pubnub
Laravel 9+10
将ServiceProvider添加到config/app.php文件中的providers数组中
'providers' => [ 'PubNub\PubnubDriver\PubnubServiceProvider', ]
Lumen
对于Lumen,在bootstrap/app.php中添加以下内容
$app->register(PubNub\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。