Wrapper class for accessing video services information in a standarized way

1.0.11 2018-04-03 08:42 UTC


Build Status

What is this!

With this wrapper class you can manage any video service 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. With Panorama-PHP API you get this information:

    $video = new \Panorama\Video("")
    $video.getTitle() => "paradon del portero"
    $video.getThumbnail() => ""
    $video.getEmbedUrl() => ""
    $video.getEmbedHTML()(width, height) => "<object [...]</object>"
    $video.getFLV() => "http://...flv"
    # all together :)
    $video.getVideoDetails(width, height) => {
                                            'title' => ...,
                                            'thumbnail' => ...,
                                            'embed_url' => ...,
                                            'embed_html' => ...,
                                            'flv' => ...

Install it!

  1. Just put in one of your include_path folders, and make sure to use an PSR-0-compatible autoloader.


This library only depends on PHP 5.6, you have to use namespaces and some other goodies of 5.4 version.

Please don't ask for PHP < 5.6 support, you shouldn't use it. In the near future we will move to 7.0 as minimum version.

Use it!

The idea is make it as simple as possible. For a URL video like

    $video = new \Panorama\Video("")

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

  • getTitle: A method to know the title of the video of the service.

      => "Beached"
  • getService: A method to know the name of the video provider service.

    => "Vimeo"
  • getThumbnail: An image representation of the video. Each service has a different size, but... it works :)

      => ""
  • getEmbedUrl: The url (with flashvars) of the video player.

      => " [...] &show_portrait=1"
  • getEmbedHTML(width, height): Uses the embed_url to build an oembed string. The default width x height is 425 x 344, but we can specify a different one.

      $video.getEmbedHTML(400, 300)
      => "<object width='400' height='300'><param name='mo [...] 300'></embed></object>"
  • getFLV: Gets the flv url. Not all the services has this option. Remember that in some services the flv url expires and in their terms don't allow using the flv without its player.

      => " [...] 8ee400/video.flv"
  • getVideoDetails(width, height): All together :), returns all the previous elements in a hash. Width and height can be specified to build the embed_html.

      => "array( [...] )"

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.

Test it!

Help us to mantain this library updated. Run our behaviour tests with behat to give us feedback about what services don't work anymore.

For running tests:

  1. Install composer in your system
  2. Install dependencies: composer install
  3. Execute the tests: bin/behat features

Build Status


And... what else?

If you find a bug or want to suggest a new video service, please let us know in a ticket.