Fork me on GitHub

Panorama-PHP by frandieguez

Wrapper PHP class to fetch information about videos on online services in a standarized way. It is an easy way to obtain a few basics about a video only through its url.

What's this?

With this wrapper class you can fetch information from multiple video services in a uniformed and unique way. You only need the URL from the video service you are going to use.

A quick example

To include this video in a post you only need to know the url of the video. Panorama-PHP API will handle all the background connections to supported video services for getting all the video information:

$video = new \Panorama\Video("http://www.youtube.com/watch?v=GPQnbtldFyo")

$video->getTitle() => "paradon del portero"
$video->getThumbnail() => "http://i4.ytimg.com/vi/GPQnbtldFyo/default.jpg"
$video->getEmbedUrl() => "http://www.youtube.com/v/GPQnbtldFyo"
$video->getEmbedHTML()(width, height) => "<object> [...]</object>"
$video->getFLV() => "http://...flv"
# or all together :)
$video->getVideoDetails(width, height) => {
                                        'title' => ...,
                                        'thumbnail' => ...,
                                        'embed_url' => ...,
                                        'embed_html' => ...,
                                        'flv' => ...
                                      }

Instalation

  1. Put Panorama library in one of your include_path folders
  2. Make sure to use an PSR-0-compatible autoloader.

Dependencies

This library depends on

  1. Zend GData for access the Youtube API.
  2. Obviosly PHP 5.3, you have to use namespaces and some other goodies of 5.3 version.

Please don't ask for PHP < 5.3 support, you shouldn't use PHP 5.2 at all.

How to use it!

The idea is make it as simple as possible. For a URL video like http://vimeo.com/1785993:

$video = new \Panorama\Video("http://vimeo.com/1785993")

Then you have methods to know information about the video in your application.

Supported services

At this moment we support the following video services:

Broken services

These services were included in this API but, due changes in their website, don't work anymore. Any patch for fixing them are welcome. ;)

If you detect new broken services by running the tests please let me know.

We are always open to incude new services.

Authors

Fran Diéguez (fran@openhost.es)

Contact

Fran Diéguez (fran@openhost.es)

Download

You can download this project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://github.com/frandieguez/Panorama-PHP