2017 © Pedro Peláez
 

library media-manager-api-php

A PHP Library for interacting with the Media Manager APIs.

image

media-manager/media-manager-api-php

A PHP Library for interacting with the Media Manager APIs.

  • Wednesday, March 30, 2016
  • by dale.mooney
  • Repository
  • 3 Watchers
  • 0 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Media Manager API - PHP

A PHP library for interacting with the Media Manager APIs., (*1)

StyleCI Coverage Status Build Status, (*2)

Installing

The library can be installed via Composer. Simply include the library in your require block in composer.json., (*3)

{
    "require": {
        "media-manager/media-manager-api-php": "dev-master"
    }
}

And then run the composer install, (*4)

composer install

Now you can require the autoload., (*5)

require 'vendor/autoload.php';

//Create the gateway or request used to get data.
$gateway = new MediaManager\HTTP\CurlRequest();

//CREATE MEDIAMANAGER INSTANCE
$MediaManager = new \MediaManager\MediaManager("{shortname}", "{apiKey}", $gateway);

Client

You can get your client data by using the getClient method., (*6)

$client = $MediaManager->api()->getClient();

Templates

Getting all templates, (*7)

You can get all templates attached to your account., (*8)

$videos = $MediaManager->api()->getTemplates();

Playlists

Getting all playlists, (*9)

You can get all playlists attached to your account., (*10)

$videos = $MediaManager->api()->getPlaylists();

Videos

You can get all your videos or a single video., (*11)

Getting all videos, (*12)

$videos = $MediaManager->api()->getVideos();

Getting a video, (*13)

$videos = $MediaManager->api()->getVideo("{videoid}");

External

Media Manager has a number of external APIs. These are mainly used for Javascript based calls, but can still be called via PHP using this library., (*14)

Templates

Searching videos, (*15)

You can search all videos on a given external template. You can pass up to 25 terms to search against (as an array). The search is purformed on titles, descriptions and tags., (*16)

$searchResults = $MediaManager->ExternalAPI->searchTemplateVideos("{external_template_id}", array("hello", "world"));

Most viewed videos, (*17)

$mostViewed = $MediaManager->ExternalAPI->getTemplateMostViewedVideos("{external_template_id}");

Recommend videos, (*18)

You can use the recommend API to get recommendations based on a video you pass., (*19)

$mostViewed = $MediaManager->external()->recommendTemplateVideo("{external_template_id}","{videoid}");

Latest videos, (*20)

Get the latest videos on template, (*21)

$latest = $MediaManager->external()->getTemplateLatestVideos("{external_template_id}");

Get video on template, (*22)

Get a video details thats published to template., (*23)

$video = $MediaManager->external()->getTemplateVideo("{external_template_id}", "{videoid}");

Get videos on template, (*24)

Get all videos on template., (*25)

$videos = $MediaManager->external()->getTemplateVideos("{external_template_id}");

Get audios on template, (*26)

Get all audios on template., (*27)

$audios = $MediaManager->external()->getTemplateAudios("{external_template_id}");

Playlists

All these playlist APIS will require a templateID also. They allow you filter down videos that appear in a playlist and also a external template., (*28)

Get videos in playlist, (*29)

Get all videos published to a playlist, (*30)

$videos = $MediaManager->external()->getPlaylistVideosOnTemplate("{playlist_id}","{external_template_id}");

Get audios in playlist, (*31)

Get all audios published to a playlist, (*32)

$audios = $MediaManager->external()->getPlaylistAudiosOnTemplate("{playlist_id}","{external_template_id}");

Get video in playlist, (*33)

Get video published to a playlist, (*34)

$video = $MediaManager->external()->getPlaylistVideoOnTemplate("{playlist_id}","{external_template_id}","{video_id"});

Get audio in playlist, (*35)

Get audio published to a playlist, (*36)

$video = $MediaManager->external()->getPlaylistAudioOnTemplate("{playlist_id}","{external_template_id}","{audio_id"});

Analytics

You can also query your analytics., (*37)

Query Builder, (*38)

You can also make use of the Query Builder., (*39)

$Query = new MediaManager\Analytics\Query();

You can then pass this into the Query method., (*40)

$query = $MediaManager->API->Analytics()->query($Query);

This will perform the most simple query, which would be SHOW Video. You can build on the query builder and add conditions and so on., (*41)

//Get current Show query.
$Show = $Query->get();

The default SHOW is for videos, but you can change it by calling the Show() method., (*42)

//Set the Show query to an Audo query.
$Show = $Query->Show("Audio");

Adding condition, (*43)

$Show->Condition("title", "hello world");

By default the conditon will use the opreator IS. This can be changed by passing a third parameter., (*44)

$Show->Condition("title", "hello world", "ISNOT");

When you have more than one conditon on a query a operator is used to seperate them. There are two options AND, OR. By default AND is used. This can be changed by setting the Logical method., (*45)

$Show->Condition("title", "new")->Logical("OR");
$Show->Condition("title", "manager")->Logical("OR");
$Show->Condition("title", "test");

Filtering

You can also filter down the content returned by the API., (*46)

//ADD TEMPLATE FILTER
$MediaManager->API->addTemplateFilter("{template}");

//GET VIDEOS
$videos = $MediaManager->API->getVideos();

So this filter allows you to only return videos that are published to a given template. You can continue to add other filters., (*47)

//ADD TEMPLATE FILTER
$MediaManager->API->addTemplateFilter("{template}");

//ADD PLAYLIST FILTER
$MediaManager->API->addPlaylistFilter("{playlist}");

//GET VIDEOS
$videos = $MediaManager->API->getVideos();

So now we only want to return videos that are published to a given template, but also published to a given playlist., (*48)

Paging

Some API calls will return paged content. So the getVideos method will be returned as a MediaManager\Pager\Pager object. This can be easily iterated using a simple loop., (*49)

//GET VIDEOS
$videos = $MediaManager->API->getVideos();

//LOOP THROUGH FIRST PAGE
foreach($videos as $key => $video){

}

Pager filters, (*50)

Sometimes you may want to change the pager filters. For instance if you wanted to limit the number of items returned., (*51)

//ADD A PAGE FILER
$MediaManager->API->addFilter("perPage","10");

//GET VIDEOS
$videos = $MediaManager->API->getVideos();

The Versions

30/03 2016

dev-patch/comments

dev-patch/comments

A PHP Library for interacting with the Media Manager APIs.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

by Dale Mooney

30/03 2016

dev-analysis-8L3pRk

dev-analysis-8L3pRk

A PHP Library for interacting with the Media Manager APIs.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

by Dale Mooney

29/02 2016

dev-analysis-87aMg2

dev-analysis-87aMg2

A PHP Library for interacting with the Media Manager APIs.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

by Dale Mooney

26/02 2016

dev-master

9999999-dev

A PHP Library for interacting with the Media Manager APIs.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

by Dale Mooney

26/02 2016

1.0.0

1.0.0.0

A PHP Library for interacting with the Media Manager APIs.

  Sources   Download

The Requires

  • php >=5.3.0

 

The Development Requires

by Dale Mooney