yasserbelhimer/agora-access-token-generator
最新稳定版本:1.0.0
Composer 安装命令:
composer require yasserbelhimer/agora-access-token-generator
包简介
RTC Token generator
README 文档
README
Simple laravel package to generate access token for RTC agora
Installation, and Usage Instructions
This package allows you to generate Agora access token using laravel.
composer require yasserbelhimer/agora-access-token-generator
First at all generate your APP_ID and APP_CERTIFICATE from agora dashboard
Set AGORA_APP_ID and AGORA_APP_CERTIFICATE in the .env
AGORA_APP_ID= your agora app id AGORA_APP_CERTIFICATE= your agora certificate token
Once installed you can do stuff like this:
To know more about arguments and parametres check Agora documentation.
Generate RTC token:
To generate rtc token use the static methode buildTokenWithUserAccount() in RtcTokenBuilder class.
$appID = env('AGORA_APP_ID'); $appCertificate = env('AGORA_APP_CERTIFICATE'); $channelName = $request->channelName; $user = Auth::user()->name; $role = RtcTokenBuilder::RoleAttendee; $expireTimeInSeconds = 3600; $currentTimestamp = now()->getTimestamp(); $privilegeExpiredTs = $currentTimestamp + $expireTimeInSeconds; $rtcToken = RtcTokenBuilder::buildTokenWithUserAccount($appID, $appCertificate, $channelName, $user, $role, $privilegeExpiredTs);
统计信息
- 总下载量: 7.98k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-06