espresso-dev/zoom-php

A simple PHP class for accessing the Zoom API

v1.0.1 2020-12-07 06:01 UTC

This package is auto-updated.

Last update: 2024-11-07 14:49:41 UTC


README

A simple PHP wrapper for the Zoom API

Latest Stable Version License Total Downloads

Composer package available.

Requirements

  • PHP 7 or higher
  • cURL
  • Zoom Developer Account
  • Zoom App

Get started

To use the Zoom API, you will need to register a Zoom app. Follow the Create an OAuth App guide.

Installation

I strongly advice using Composer to keep updates as smooth as possible.

$ composer require espresso-dev/zoom-php

Initialize the class

use EspressoDev\Zoom\Zoom;

$zoom = new Zoom([
    'appId' => 'YOUR_APP_ID',
    'appSecret' => 'YOUR_APP_SECRET',
    'redirectUri' => 'YOUR_APP_REDIRECT_URI'
]);

echo "<a href='{$zoom->getLoginUrl()}'>Login with Zoom</a>";

Authenticate user (OAuth2)

// Get the OAuth callback code
$code = $_GET['code'];

// Get the access token (valid for 1 hour) and refresh token
$token = $zoom->getOAuthToken($code);

echo 'Your token is: ' . $token->access_token;
echo 'Your refresh token is: ' . $token->refresh_token;

Get users scheduled meetings

// Set user access token
$zoom->setAccessToken($token);

// Get the users scheduled meetins
$meetings = $zoom->getUserMeetings('me', 'scheduled');

echo '<pre>';
print_r($meetings);
echo '<pre>';

All methods return the API data as json_decode() - so you can directly access the data.

Available methods

Setup Zoom

new Zoom(<array>/<string>);

array if you want to perform oAuth:

new Zoom([
    'appId' => 'YOUR_APP_ID',
    'appSecret' => 'YOUR_APP_SECRET',
    'redirectUri' => 'YOUR_APP_REDIRECT_URI'
]);

string once you have a token and just want to return read-only data:

new Zoom('ACCESS_TOKEN');

Get login URL

getLoginUrl(<string>)

getLoginUrl(
    'state'
);

Get OAuth token (Short lived valid for 1 hour)

getOAuthToken($code)

Refresh access token for another 1 hour and get updated refresh token

refreshToken($refreshToken)

Set / Get access token

  • Set the access token, for further method calls: setAccessToken($token)
  • Get the access token, if you want to store it for later usage: getAccessToken()

User methods

See Zoom API Documentation for more information about each method.

Authenticated methods

  • getUserMeetings(<$id>, <$type>, <$page_size>, <$page_number>)
  • getUserMeetings(<$id>, <$page_size>, <$page_number>)