Via Composer
composer require shapintv/vimeouse 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);// Get a video
$video = $client->videos()->get(362164795);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...
The MIT License (MIT). Please see License File for more information.