A brand new, much more simple, PHPViddler

We have wrappers for our API in many different programming languages. One of the more popular wrappers has always been PHPViddler which is available as an open source project on Github. Today we’re releasing PHPViddler 2 which is all new, much more simple, and uses our brand new API version 2 (which we launched not too long ago).

We wanted PHPViddler 2 to be very, very simple in its use and allow developers to build upon it for their own custom solutions. One way that we handled this was by making each method name in the PHPViddler 2 class be exactly the same as the API method that you want to use. This may seem like a no-brainer but in PHPViddler 1.0 (which is still available, and still supported by the way) we didn’t do things this way.

Here is an example. In PHPViddler 1.0 to authenticate a Viddler user you’d call user_authenticate in the PHPViddler 1.0 class and send it two or a third optional argument such as $user, $pass, and $getToken. Here, I’ll show you.


include('php/phpviddler/phpviddler.php');
$v = new Phpviddler();
$v->apiKey = 'YOUR API KEY HERE';
$v->viddlerREST = 'http://api.viddler.com/rest/v1/';
// Authenticate a user
$user = $v->user_authenticate('username','password');
// $user['auth']['sessionid'] would be set here.

This may seem easy enough however a developer would be required to remember the method names of the PHPViddler 1.0 class rather than simply knowing the method as dictated by the API itself. Now with PHPViddler 2 the class methods follow the naming conventions of the API Version 2. Here, this is the same example using PHPViddler 2.


include('/path/to/phpviddler.php');
$v = new Viddler_V2('Your API key here');
// Authenticate a user
$user = $v->viddler_users_auth(array('user'=>'username','password'=>'password'));
// $user['auth']['sessionid'] would be set here.

Now the class method name actually determines the API method you would like to use. The arguments that the class method accepts is identical to the API method arguments that are required or optional.

It is also worth nothing that PHPViddler 1.0 required an entire XML parsing library or for the developer to build their own. Since our new API has a PHP response type as an option, PHPViddler 2 simply uses this by default. Cutting the codebase for the wrapper down considerably and speeding up both the response time of the API and the speed of your applications.

There are many advantages to using PHPViddler 2 in your next app and even updating your current applications to take advantage of the new API. If you need any help doing any of this please get in contact with us in our Developers Group.