Download the PHP package mmockelyn/dailymotion-php-sdk without Composer

On this page you can find all versions of the php package mmockelyn/dailymotion-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dailymotion-php-sdk

Dailymotion PHP SDK

This repository contains the official open source PHP SDK that facilitates access to the Dailymotion Graph API from your PHP application. For more information about developing with Dailymotion's services, head to the Developer Area.

Usage

The PHP SDK implements the Dailymotion Advanced API. For a list of all available methods, see the complete API reference. To call a method using the PHP SDK, use the get, post or delete methods as follow:

The $result variable contains the result of the method (as described in the Graph API overview) as an array.

Authentication

The Dailymotion API requires OAuth 2.0 authentication in order to access protected resources.

Contrary to most OAuth SDKs, the Dailymotion PHP SDK implements lazy authentication, which means that no authentication request is sent as long as no data is requested from the API. At which point, two requests are sent back-to-back during the first request for information, one to authenticate and one to fetch the data. Keep this in mind while working through the rest of the documentation.

Please note that the Dailymotion PHP SDK also takes care of abstracting the entire OAuth flow, from retrieving, storing and using access tokens, to using refresh tokens to gather new access tokens automatically. You shouldn't have to deal with access tokens manually but if you have to, at the programming-level, the SDK exposes this information with the Dailymotion::getSession() and Dailymotion::setSession() methods. At the OAuth-level, a session is the response sent by the OAuth server when successfully authenticated, for example:

Note: One of the problems with OAuth 2.0 is that the specification doesn't offer any mechanism to upgrade the scope of an existing session. To add new scopes to an already existing session, you first need to call the Dailymotion::logout() method and start a new session with your new list of scopes.

If you really wish to manually retrieve an access token without waiting for the SDK to take care of it when sending the first query, you can use the Dailymotion::getAccessToken() method. It will try to authenticate and return you the corresponding access token or an exception. Please note that this isn't the recommended way to proceed. See the Overloading the SDK section for more information about handling access tokens.

This library implements three OAuth 2.0 granting methods for different kind of usages.

Authorization Grant Type

This grant type is the one you should use in most cases. With this grant type you redirect the user to an authorization page on Dailymotion and your application is called back once the end-user authorized your API key to access Dailymotion on his/her behalf.

Here is a usage example:

Password Grant Type

If your PHP application isn't a web application and cannot redirect the user to the Dailymotion authorization page, the password grant type can be used instead of the authorization one. With this grant type you have the responsibility to ask the user for its credentials. Make sure your API secret remains secret though, do not use this kind of authentication for any service that is running on the client if you do not want your API secret to be publicly exposed.

Here is a usage example:

Client Credentials Grant Type

If you don't need to access the Dailymotion API on behalf of someone else because, for instance, you only plan to access public data, you can use the client credentials grant type. With this grant type, you will only have access to public data or data protected by a specific scope and/or role. It's the equivalent of being unlogged but having the permission (granted by Dailymotion as part of a partners program or similar) to access sensitive data.

Here is a usage example:

There is no authenticated user in this scenario, thus you won't be able to access the /me endpoint.

Upload File

Some methods like POST /me/videos requires a URL to a file. To create those URLs, Dailymotion offers a temporary upload service through the Dailymotion::uploadFile() method which can be used like this:

You can then use this $url result as an argument to methods requiring such a parameter. For instance to create a video:

You can also retrieve a progress URL like this:

Hitting this URL after the upload has started allows you to monitor the upload progress.

Overloading the SDK

As stated in the Authentication section above, the PHP SDK takes care of abstracting the entire OAuth flow, from retrieving, storing and using access tokens, to using refresh tokens to gather new access tokens automatically.

Overloading the SDK with your own implementation allows you to adapt the SDK behaviour to your needs. The most common usage is to overload both Dailymotion::storeSession() and Dailymotion::readSession() methods to change the default storage system (which uses cookies).

Here is a crude example of overloading the SDK to store sessions (access token + refresh token) on the file system instead of using cookies (for a command line program for example):

Don't hesitate to extend the functionalities of the SDK and send us pull requests once you're done! And again, if you think that something's wrong, don't hesitate to report any issue.


All versions of dailymotion-php-sdk with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mmockelyn/dailymotion-php-sdk contains the following files

Loading the files please wait ....