Download the PHP package riven/hyperf-zego without Composer
On this page you can find all versions of the php package riven/hyperf-zego. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download riven/hyperf-zego
More information about riven/hyperf-zego
Files in riven/hyperf-zego
Download riven/hyperf-zego
More information about riven/hyperf-zego
Files in riven/hyperf-zego
Vendor riven
Package hyperf-zego
Short Description Zego Server Assistant
License MIT
Homepage https://github.com/woweijun123/zego
Package hyperf-zego
Short Description Zego Server Assistant
License MIT
Homepage https://github.com/woweijun123/zego
Keywords zegoServer Assistant
Please rate this library. Is it a good library?
Informations about the package hyperf-zego
Hyperf Zego 服务端助手
本项目是基于 Hyperf 框架的 Zego 服务端助手库,提供了生成 Zego 令牌的功能,支持普通令牌和强验证令牌的生成。
安装
方法一:通过 Composer 安装
-
在你的 Hyperf 项目中执行以下命令:
- 发布配置文件:
方法二:手动安装
- 拷贝文件包至项目根目录下的
vendor/riven/hyperf-zego目录 - 执行
composer dump-autoload命令生成自动加载文件 - 发布配置文件:
配置
发布配置文件后,你可以在 config/autoload/zego.php 文件中配置 Zego 的参数:
你也可以在 .env 文件中设置环境变量:
使用
普通令牌生成
普通令牌用于服务接口的简单权限验证场景,payload 字段可传空。
强验证令牌生成
强验证令牌用于对房间登录/推拉流权限需要进行强验证的场景,payload 字段需要按照规格生成。
错误码说明
| 错误码 | 说明 |
|---|---|
| 0 | 获取鉴权 token 成功 |
| 1 | 调用方法时传入 appID 参数错误 |
| 3 | 调用方法时传入 userID 参数错误 |
| 5 | 调用方法时传入 secret 参数错误 |
| 6 | 调用方法时传入 effectiveTimeInSeconds 参数错误 |
API 说明
generateToken04 方法
返回值
返回值为 ZEGO\ZegoAssistantToken 对象:
测试
本项目包含测试用例,你可以通过以下命令运行测试:
测试用例会从配置文件中读取参数,验证令牌生成功能是否正常。
注意事项
- 请妥善保管你的
secret,切勿外泄 - 令牌有过期时间,请注意在过期前重新生成
- 强验证令牌的 payload 格式必须按照规定生成,否则可能导致验证失败
- 在生产环境中,建议将配置信息存储在环境变量中,而不是直接硬编码在配置文件中
All versions of hyperf-zego with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.3
hyperf/guzzle Version ^3.1
hyperf/config Version ~3.1.0
ext-openssl Version *
hyperf/guzzle Version ^3.1
hyperf/config Version ~3.1.0
ext-openssl Version *
The package riven/hyperf-zego contains the following files
Loading the files please wait ...