willywes/agora-sdk-php

Agora.io SDK PHP
25,003 10
Install
composer require willywes/agora-sdk-php
Latest Version:v0.1.3
License:MIT
Last Updated:Apr 28, 2022
Links: GitHub  ·  Packagist
Maintainer: Willywes

AgoraSDK

Latest Version on Packagist Total Downloads Build Status StyleCI

PHP SDK Agora.io (unofficial) Token Generator

Installation

Via Composer

$ composer require willywes/agora-sdk-php

Usage

use Willywes\AgoraSDK\RtcTokenBuilder;

class AgoraHelper
{
    public static function GetToken($user_id){
    
        $appID = "72fc...";
        $appCertificate = "72fc...";
        $channelName = "Test";
        $uid = $user_id;
        $uidStr = ($user_id) . '';
        $role = RtcTokenBuilder::RoleAttendee;
        $expireTimeInSeconds = 3600;
        $currentTimestamp = (new \DateTime("now", new \DateTimeZone('UTC')))->getTimestamp();
        $privilegeExpiredTs = $currentTimestamp + $expireTimeInSeconds;
    
        return RtcTokenBuilder::buildTokenWithUid($appID, $appCertificate, $channelName, $uid, $role, $privilegeExpiredTs);
    
    }
}
    $user = auth()->user();
    $agora_token = AgoraHelper::GetToken($user->id);

Credits

License

license. Please see the license file for more information.

Related Packages

bright-tech/laravel-aliyunoss-video-service

阿里云视频转码 laravel

2,852 0
edbizarro/laravel-facebook-ads

Facebook & Instagram Ads for Laravel 5.6

30,141 135
hkonnet/laravel-ebay

This package is wrapper for php Ebay sdk for laravel to automate all the configu...

53,003 39
sportbook/sdk

SportBook SDK PHP - Integration function

226 1