Skip to content

PHP SDK Agora.io (unofficial) Token Generator

License

Notifications You must be signed in to change notification settings

cyberwolf-studio/agora-sdk-php

 
 

Repository files navigation

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.

About

PHP SDK Agora.io (unofficial) Token Generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%