PHP code example of t3mnikov / livekit-sdk-php
1. Go to this page and download the library: Download t3mnikov/livekit-sdk-php 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/ */
t3mnikov / livekit-sdk-php example snippets
use T3mnikov\AccessToken;
use T3mnikov\AccessTokenOptions;
$tokenOptions = new AccessTokenOptions();
$tokenOptions->setName('My Name');
$tokenOptions->setIdentity('Anybody');
$accessToken = new AccessToken($apiKey, $secret, $tokenOptions);
$grants = new VideoGrant();
$grants->setRoomName($testRoom);
$grants->setRoomJoin();
$accessToken->addGrant($grants);
echo $token = $accessToken->getToken();
use T3mnikov\RoomServiceClient;
$host = 'https://my.livekit.host';
$service = new RoomServiceClient($host, 'api-key', 'secret-key');
// List rooms.
$rooms = $service->listRooms();
composer