ivoba/vimeo-api-service-provider

A Vimeo Api ServiceProvider for Silex.

1.0.0 2015-03-17 08:57 UTC

This package is auto-updated.

Last update: 2024-12-10 21:52:38 UTC


README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Service Provider that integrates Vimeo's official PHP API libary to Silex

Install

Via Composer

$ composer require ivoba/vimeo-api-service-provider

Usage

Register the Provider:

$app->register(new Ivoba\Silex\VimeoApiServiceProvider(), 
               array('vimeo.options' => array('client_key' => 'key', 'client_secret' => 'secret', 'access_token' => 'your_token')));

Default modus is unauthenticated.
It is recommended that you generated the access token once, store it to your config and use it forever.
If you dont provide a token, your token will be retrieved from Vimeo for every call, which will cost performance.

To show your token, call this once in your app, in debug mode. It will throw an exception that will show your token.

$app['vimeo.api.show_token'];

Now you can use the Vimeo API with:

$app['vimeo.api']->request('/videos', array('query' => 'silex',
                     'format' => 'php',
                     'full_response' => '1',
                     'per_page' => 8,
                     'sort' => 'date'), 'GET');

Todo

I did not use authenticated mode yet, so this Provider doesnt have any helpers for it.
Feel free to provide some.

  • authenticated mode
  • token storage interface
  • set & get token from storage if set

Testing

$ vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

License

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