PHP code example of vientodigital / vimeo-api

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

    

vientodigital / vimeo-api example snippets


// The documentation refers to the following as `privacy.view`
$params = ['privacy' => ['view' => 'disable']];

// `scope` is an array of permissions your token needs to access.
// You can read more at https://developer.vimeo.com/api/authentication#supported-scopes
$token = $lib->clientCredentials(scope);

// usable access token
var_dump($token['body']['access_token']);

// accepted scopes
var_dump($token['body']['scope']);

// use the token
$lib->setToken($token['body']['access_token']);

$url = $lib->buildAuthorizationEndpoint($redirect_uri, $scopes, $state)

// `redirect_uri` must be provided, and must match your configured URI
$token = $lib->accessToken(code, redirect_uri);

// Usable access token
var_dump($token['body']['access_token']);

// Accepted scopes
var_dump($token['body']['scope']);

// Set the token
$lib->setToken($token['body']['access_token']);

$response = $lib->request('/me/videos', ['per_page' => 2], 'GET');

$response = $lib->request('/me/videos', ['per_page' => 2], 'GET');
var_dump($response['body']);

$response = $lib->upload('/home/aaron/Downloads/ada.mp4')

// With parameters.
$response = $lib->upload('/home/aaron/Downloads/ada.mp4', [
    'name' => 'Ada',
    'privacy' => [
        'view' => 'anybody'
    ]
])

$response = $lib->replace('/videos/12345', '/home/aaron/Downloads/ada-v2.mp4')

$video_response = $lib->request(
    '/me/videos',
    [
        'upload' => [
            'approach' => 'pull',
            'link' => $url
        ],
    ],
    'POST'
);

$response = $lib->uploadImage('/videos/12345/pictures', '/home/aaron/Downloads/ada.png', true)