PHP client for consuming the PBS Media Manager API.

v1.0.2 2019-07-27 03:04 UTC

This package is auto-updated.

Last update: 2020-02-27 04:29:41 UTC


This library abstracts interactions with the PBS Media Manager API based on the Media Manager Core Data Model:

PBS Media Manager Core Data Model


Install via composer:

composer require openpublicmedia/pbs-media-manager-php


The primary class provided by this library is the OpenPublicMedia\PbsMediaManager\Client. A Client instance can be used to query the API in various ways based on the Core Data Model. The client requires an API key and secret, provided by PBS.

Response data structures

Responses from the Client class will return either a Generator in the case of plural getters (e.g. getFranchises, getShows, getSeasons, etc.) or an object for singular getters (e.g. getEpisode, getCollection, etc.). In both cases, objects representing API data follow a standard structure with the following properties:

  • id: guid for the object.
  • type: string of the object type (e.g. "franchise", "show", "season", etc.).
  • links: links to related API endpoints for the object.
  • attributes: metadata about the object.


Creating a client

use OpenPublicMedia\PbsMediaManager\Client;

$api_key = 'xxxxxxxxxxxxxx'
$api_secret = 'xxxxxxxxxxx'

$client = new Client($api_key, $api_secret);

Getting all Franchises

$franchises = $client->getFranchises();

foreach ($franchises as $franchise) {
    class stdClass#45 (4) {
        public $links => class stdClass#40 (4) { ... }
        public $attributes => class stdClass#39 (18) { ... }
        public $type => string(9) "franchise"
        public $id => string(36) "e08bf78d-e6a3-44b9-b356-8753d01c7327"

Getting a single Episode

$episode = $client->getEpisode('08e7ee9c-800a-406f-86f0-bf0bb77fe42b');

class stdClass#80 (3) {
    public $attributes => class stdClass#38 (20) { ... }
    public $id => string(36) "08e7ee9c-800a-406f-86f0-bf0bb77fe42b"
    public $type => string(7) "episode"

Handling exceptions

Most plural Client getters (e.g. Client::getShows) can throw OpenPublicMedia\PbsMediaManager\Exception\BadRequestException. This exception will include a JSON encoded message that can be used to determine follow-up actions. Singular getters (e.g. Client::getShow) will generally return null for invalid IDs.

try {
    $shows = $client->getShows(['page' => 100000]);
} catch (BadRequestException $e) {
    $message = json_decode($e->getMessage());
    class stdClass#17 (1) {
      public $detail =>
      string(13) "Invalid page."

Development goals

See CONTRIBUTING for information about contributing to this project.


  • API authentication (OpenPublicMedia\PbsMediaManager\Client)
  • API direct querying ($client->request())
  • Result/error handling
  • GET wrappers for core data objects ($client->getXXX())
  • Transparent paged response handling (OpenPublicMedia\PbsMediaManager\Response\PagesResponse)


  • PUT/PATCH/POST support on relevant endpoints
  • DELETE support on relevant endpoints


  • Entities for core data objects
  • Advanced Asset availability handling
  • Advanced Changelog endpoint operations