Looking to hire Laravel developers? Try LaraJobs

laravel-goeasy maintained by vergil-lai

Description
GoEasy的Laravel广播驱动
Author
Last update
2024/08/08 12:05 (dev-main)
License
Links
Downloads
40

Comments
comments powered by Disqus

laravel-goeasy

GoEasy的Laravel广播驱动

安装需求

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

安装

$ composer require vergil-lai/laravel-goeasy

Laravel使用

配置

在 config/broadcasting.php 的connections中添加以下配置:

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

在configs/app.php的aliases中加入:

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

在GoEasy中创建应用,获取Common Key和Subscribe Key, 或者使用OTP的Rest key和Secret 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文档。

获取OTP和AccessToken

使用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.