PHP code example of msaaq / zoom-php-sdk

1. Go to this page and download the library: Download msaaq/zoom-php-sdk 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/ */

    

msaaq / zoom-php-sdk example snippets


use Msaaq\Zoom\AccessToken;
use Msaaq\Zoom\Zoom;
use Msaaq\Zoom\Clients\OAuthClient;
use Msaaq\Zoom\Clients\ServerToServerOAuthClient;

// OAuth setup
$client = new OAuthClient(
    clientId: 'client_id',
    clientSecret: 'client_secret',
    redirectUri: 'redirect_url'
);

// Server-to-Server setup
$client = new ServerToServerOAuthClient(
    clientId: 'client_id',
    clientSecret: 'client_secret',
    accountId: 'account_id',
);

$accessToken = new AccessToken(
    client: $client,
    accessToken: 'your_zoom_access_token',
    refreshToken: 'your_refresh_token',
    onTokenChange: function (array $newTokens) {
        // store new token values
    }
);

$zoom = new Zoom($accessToken);
$userInfo = $zoom->user()->get();

// Get All Meetings
$zoom->user()->meetings()->all();
// Create a Meeting
$meeting = new \Msaaq\Zoom\Models\Meeting();
$meeting->topic = 'Meeting Topic';
$zoom->user()->meetings()->create($meeting);

// Get All Webinars
$zoom->user()->webinars()->all();
// Create a Webinar
$zoom->user()->webinars()->create(// Webinar object);



// Step 1: Redirect user to Zoom OAuth
$client = new OAuthClient(
    clientId: 'client_id',
    clientSecret: 'client_secret',
    redirectUri: 'redirect_url'
);

$url = $client->getAuthorizationUrl();

return redirect()->to($url);

// Step 2: Handle callback
$tokenData = $client->createToken($code);

$newTokens = $client->refreshToken('existing_refresh_token');