PHP code example of monyxie / agora-token-builder

1. Go to this page and download the library: Download monyxie/agora-token-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

monyxie / agora-token-builder example snippets


use Monyxie\Agora\TokenBuilder\TokenFactory;
use Monyxie\Agora\TokenBuilder\AccessControl\Role;

$appId = "your app id";
$appCertificate = "your app certificate";
$channelName = "your channel name";
$uid = 91919191; // your uid
$privileges = Role::PRIVILEGES_PUBLISHER;

$token = (new TokenFactory($appId, $appCertificate))->create($channelName, $uid, $privileges);

var_dump($token->toString());