LaravelPackages.net
Acme Inc.
Toggle sidebar
willywes/agora-sdk-php

Agora.io SDK PHP

23.917
10
v0.1.3
About willywes/agora-sdk-php

willywes/agora-sdk-php is a Laravel package for agora.io sdk php. It currently has 10 GitHub stars and 23.917 downloads on Packagist (latest version v0.1.3). Install it with composer require willywes/agora-sdk-php. Discover more Laravel packages by willywes or browse all Laravel packages to compare alternatives.

Last updated

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.

Star History Chart