Zoom API for Codeigniter 4
Use the package with composer install
> composer require daycry/zoom
Download this repo and then enable it by editing app/Config/Autoload.php and adding the Daycry\Zoom namespace to the $psr4 array. For example, if you copied it into app/ThirdParty:
$psr4 = [
'Config' => APPPATH . 'Config',
APP_NAMESPACE => APPPATH,
'App' => APPPATH,
'Daycry\Zoom' => APPPATH .'ThirdParty/zoom/src',
];
Run command:
> php spark zoom:publish
This command will copy a config file to your app namespace.
$zoom = new \Daycry\Zoom\Zoom();
$zoom = \Config\Services::zoom();
In your BaseController - $helpers array, add an element with your helper filename.
protected $helpers = [ 'zoom_helper' ];
And then, you can use the helper
$zoom = zoom_instance();
/**
*
* @return AccessTokenInterface
*/
$zoom = new \Daycry\Zoom\Zoom();
$token = $zoom->authentication();
echo "<pre>";
echo json_encode( $token );
echo "</pre>";
/**
* Returns an authenticated PSR-7 request instance.
*
* @param string $method
* @param string $url
* @return RequestInterface
*/
$zoom = new \Daycry\Zoom\Zoom();
$zoom->setAccessToken( $token );
$reponse = $zoom->request( 'GET', 'users' );
echo "<pre>";
var_dump( $reponse );
echo "</pre>";
You can pass extra parametres into the request method.
/**
* Returns an authenticated PSR-7 request instance.
*
* @param string $method
* @param string $url
* @param array $options Any of "headers", "body", and "protocolVersion".
* @param AccessTokenInterface|string $token
* @return RequestInterface
*/
$zoom = new \Daycry\Zoom\Zoom();
$zoom->setAccessToken( $token );
$reponse = $zoom->request( 'GET', 'users', [], $token );
echo "<pre>";
var_dump( $reponse );
echo "</pre>";
/**
*
* @return AccessTokenInterface
*/
$zoom = new \Daycry\Zoom\Zoom();
$zoom->setAccessToken( $token );
$reponse = $zoom->refreshAccessToken();
echo "<pre>";
var_dump( $reponse );
echo "</pre>";
{"token_type":"bearer","scope":"dashboard_crc:read:admin","access_token":"xxxxx","refresh_token":"xxxxxx","expires":1586716974}