pokap/media

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (v1.0.1) of this package.

Simply media loading meta-data per link.

v1.0.1 2012-05-10 12:06 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:20:31 UTC


README

A simple way to get metadata of media link.

Requires at least PHP 5.3.3 because uses Zend library. Compatible PHP 5.4 too.

This package uses Zend framework (https://github.com/zendframework/zf2), and OpenGraph (https://github.com/scottmac/opengraph) to get meta-data with open graph protocol (http://ogp.me/).

Build Status

Usage

<?php

$media = new \Pok\Media\Media();

// one service equal to one class
// several filters to find the service in relation to the links, be careful not to forget the scheme
$media->getServiceManager()->setService(
    'youtube',
    'Pok\\Media\\Service\\Youtube',
    array('http:\/\/(www\.)?youtube\.com')
);

$uri = new \Zend\Uri\Uri('http://www.youtube.com/watch?v=uh9oUHO2dxE&useless_data');

// get instance of \Pok\Media\Service\Youtube with id (uh9oUHO2dxE), title, description of video, etc.
// false if error.
$service = $media->analyse($uri);

echo $uri->toString(); // http://www.youtube.com/watch?v=uh9oUHO2dxE

?>