njenga55/agora

Agora laravel package

v1 2022-06-06 06:46 UTC

This package is auto-updated.

Last update: 2025-06-06 14:37:23 UTC


README

generate server side tokens for agora in laravel.

installation:

installation via composer.

  composer require njenga55/agora

Usage:

Laravel

Generate sdk token

  Agora::sdkToken();

Generate Room token

  Agora::roomToken();

Generate Task token

  Agora::taskToken();

In some cases, as documented on the agora documentation, you might want to change the ability of your tokens. To set the context from which you want to generate ur access token from use

  Agora::setToken();

 Agora::setContext([
            'role' => 'ADMINROLE',
            'uuid' => 'some-uuid-value-here-especially-for-tasks-and-room'
        ])

where role can be either ADMINROLE, WRITEROLE or READERROLE

then followed by either roomToken() or taskToken()

$token = Agora::setContext([
           'role' => 'ADMINROLE',
           'uuid' => 'some-room--uuid'
       ])->roomToken()
$token = Agora::setContext([
          'role' => 'ADMINROLE',
          'uuid' => 'some-task--uuid'
      ])->taskToken()

Licence:

MIT