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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package hyperf-zego

Hyperf Zego 服务端助手

本项目是基于 Hyperf 框架的 Zego 服务端助手库,提供了生成 Zego 令牌的功能,支持普通令牌和强验证令牌的生成。

安装

方法一:通过 Composer 安装

  1. 在你的 Hyperf 项目中执行以下命令:

  2. 发布配置文件:

方法二:手动安装

  1. 拷贝文件包至项目根目录下的 vendor/riven/hyperf-zego 目录
  2. 执行 composer dump-autoload 命令生成自动加载文件
  3. 发布配置文件:

配置

发布配置文件后,你可以在 config/autoload/zego.php 文件中配置 Zego 的参数:

你也可以在 .env 文件中设置环境变量:

使用

普通令牌生成

普通令牌用于服务接口的简单权限验证场景,payload 字段可传空。

强验证令牌生成

强验证令牌用于对房间登录/推拉流权限需要进行强验证的场景,payload 字段需要按照规格生成。

错误码说明

错误码 说明
0 获取鉴权 token 成功
1 调用方法时传入 appID 参数错误
3 调用方法时传入 userID 参数错误
5 调用方法时传入 secret 参数错误
6 调用方法时传入 effectiveTimeInSeconds 参数错误

API 说明

generateToken04 方法

返回值

返回值为 ZEGO\ZegoAssistantToken 对象:

测试

本项目包含测试用例,你可以通过以下命令运行测试:

测试用例会从配置文件中读取参数,验证令牌生成功能是否正常。

注意事项

  1. 请妥善保管你的 secret,切勿外泄
  2. 令牌有过期时间,请注意在过期前重新生成
  3. 强验证令牌的 payload 格式必须按照规定生成,否则可能导致验证失败
  4. 在生产环境中,建议将配置信息存储在环境变量中,而不是直接硬编码在配置文件中

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 *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package riven/hyperf-zego contains the following files

Loading the files please wait ...