PHP code example of vonage / video

1. Go to this page and download the library: Download vonage/video 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/ */

    

vonage / video example snippets




use Vonage\Client;
use Vonage\Client\Credentials\Keypair;
use Vonage\Video\ClientFactory;

$credentials = new Keypair('private-key-string', 'application-id');
$client = new Client($credentials);
$vonageVideoClient = $client->video();

$credentials = new Keypair('private-key-string', 'application-id');
$options = ['base_video_url' => 'https://local-testing.video.example.com'];
$client = new Client($credentials. $options);

$session = $client->video()->createSession();
echo $session->getSessionId();

use Vonage\Video;
use Vonage\Video\Archive\ArchiveMode;

$session = $client->video()->createSession(new SessionOptions(['archiveMode' => ArchiveMode::ALWAYS]));
echo $session->getSessionId();

$token = $client->video()->generateClientToken($session->getSessionId());