shapin/vimeo

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP client for Vimeo API

dev-master 2020-03-09 13:53 UTC

This package is auto-updated.

Last update: 2023-12-27 11:25:13 UTC


README

Latest version Build status Total downloads

Install

Via Composer

composer require shapintv/vimeo

Usage

Create a VimeoClient

use Shapin\Vimeo\VimeoClient;
use Symfony\Component\HttpClient\HttpClient;

$httpClient = HttpClient::create([
    'base_uri' => 'https://api.vimeo.com/',
    'auth_bearer' => self::VIMEO_TOKEN,
    'headers' => [
        'Content-Type' => 'application/json',
        'Accept' => 'application/vnd.vimeo.*+json;version=3.4',
    ],
]);

$client = new VimeoClient($httpClient);

Deal with videos

// Get a video
$video = $client->videos()->get(362164795);

Integration with symfony

Create a new HttpClient:

framework:
    http_client:
        scoped_clients:
            vimeo.client:
                base_uri: 'https://api.vimeo.com/'
                auth_bearer: '%env(VIMEO_TOKEN)%'
                headers:
                    'Content-Type': 'application/json'
                    'Accept': 'application/vnd.vimeo.*+json;version=3.4'

Then create your service:

services:
    Shapin\Vimeo\VimeoClient: ['@vimeo.client', ~]

When do not use autowiring here in order to avoid the injection of the default Serializer if you have one. This SDK directly build its own Serializer when none is passed which is fine for most use cases.

One day, I may consider creating a bundle in order to bootstrap this SDK...

License

The MIT License (MIT). Please see License File for more information.