vergil-lai/laravel-goeasy

GoEasy的Laravel广播驱动

v0.1.3 2023-10-29 04:01 UTC

This package is not auto-updated.

Last update: 2024-04-28 06:16:38 UTC


README

laravel-goeasy

GoEasyLaravel广播驱动

安装需求

  • PHP >= 8.0
  • Laravel >= 9.x | 10.x

安装

$ composer require vergil-lai/laravel-goeasy

Laravel使用

配置

config/broadcasting.phpconnections中添加以下配置:

'goeasy' => [
    'driver' => 'goeasy',
],

configs/app.phpaliases中加入:

'GoEasy' => \VergilLai\LaravelGoeasy\Facades\GoEasy::class,

GoEasy中创建应用,获取Common KeySubscribe Key, 或者使用OTPRest keySecret key

.env文件加入:

BROADCAST_DRIVER=goeasy
GOEASY_HOST=https://rest-hz.goeasy.io 
## 或rest-singapore.goeasy.io
GOEASY_COMMON_KEY=your-common-key
GOEASY_SUBSCRIBE_KEY=your-subscribe-key

GOEASY_REST_KEY=your-rest-key
GOEASY_SECRET_KEY=your-secret-key

这样,就可以使用broadcast广播事件了。 详情请参阅Laravel文档

获取OTPAccessToken

使用GoEasyFacade方法:

GoEasy::otp();
GoEasy::pubsub()->makeAccessToken('your user id', 'channel name', $readable, $writeable),

客户端使用

请参阅GoEasy官方文档

License

The MIT License (MIT). Please see License File for more information.