bluesik / tv-maze-api
Library for interacting with TVMaze's API
Installs: 60
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/bluesik/tv-maze-api
Requires
- php: ^7.1.3
- guzzlehttp/guzzle: ^6.3
- nesbot/carbon: ^1.32
This package is not auto-updated.
Last update: 2025-10-26 12:00:28 UTC
README
- TVMaze API - PHP Wrapper
- Description
- Installation
- Usage
- Available methods
- Shows
- Search shows containing given name
- Search show by name
- Get show by its id
- Get show by TVRage id
- Get show by THETVDB id
- Get show by IMDB id
- Get episodes from a given show's id
- Get a list of seasons for a given show
- Get a cast from a show with a given id
- Get a crew from a show with a given id
- Get a list of AKAs from a show with a given id
- Get all shows
- Get a list containing information about when each show was last updated
- Episodes
- People
- Shows
- License
Description
An easy to use PHP Wrapper around TVMaze's API. All endpoints are supported. (As of Aug 1st 2018)
All TVMaze resources have been turned into objects, so you can interact with them in a OOP way.
For convenience, all dates have been turned into Carbon objects.
Installation
composer require bluesik/tv-maze-api
Usage
<?php require "vendor/autoload.php"; use TVMaze\API\Client as TVMaze; // New it up $tv = new TVMaze(); // Example usage $data = $tv->shows->getById(123);
All embedded resources will be extracted and turned into respective classes (if possible)
Example:
$show = $tv->shows->searchOne('Daredevil', ['episodes']); var_dump($show->episodes); // Gives you an array of \TVMaze\Data\Episode objects
Available methods
Shows
Search shows containing given name
$tv->shows->searchMany('CSI');
Params:
String$nameName to search for
Returns an array of \TVMaze\Data\Show objects or null
Search show by name
$tv->shows->searchOne('Daredevil', ['episodes']);
Params:
String$nameName to seatch for
Array$embedAn array of resources to embedDefaults to: An empty array
Returns a \TVMaze\Data\Show object or null
Get show by its id
$tv->shows->getById(82, ['episodes']);
Params:
Integer$idShow id
Array$embedAn array of resources to embedDefaults to: An empty array
Returns a \TVMaze\Data\Show object or null
Get show by TVRage id
$tv->shows->getByTVRage(38796);
Params:
Integer$idTVRage id
Returns a \TVMaze\Data\Show object or null
Get show by THETVDB id
$tv->shows->getByTVDB(281662);
Params:
Integer$idTVDB id
Returns a \TVMaze\Data\Show object or null
Get show by IMDB id
$tv->shows->getByIMDB("tt4122068");
Params:
Integer$idIMDB id
Returns a \TVMaze\Data\Show object or null
Get episodes from a given show's id
$tv->shows->getEpisodes(123, $withSpecials = false);
Params:
Integer$idShow id
Boolean$withSpecialsShould special episodes be includedDefualts to: false
Returns an array of \TVMaze\Data\Episode objects or null
Get a list of seasons for a given show
$tv->shows->getSeasons(170);
Params:
Integer$idShow id
Returns an array of \TVMaze\Data\Season objects or null
Get a cast from a show with a given id
$tv->shows->getCast(170);
Params:
Integer$idShow id
Returns an array of \TVMaze\Data\Cast objects or null
Get a crew from a show with a given id
$tv->shows->getCrew(170);
Params:
Integer$idShow id
Returns an array of \TVMaze\Data\Crew objects or null
Get a list of AKAs from a show with a given id
$tv->shows->getAKA(170);
Params:
Integer$idShow id
Returns an array of \TVMaze\Data\AKA objects or null
Get all shows
$tv->shows->getAll($page = 2);
Params:
Integer$pageWhich page to getDefualts to: 0
Returns an array of \TVMaze\Data\Show objects or null
Get a list containing information about when each show was last updated
$tv->shows->getUpdates();
Returns an array or null
Episodes
Get a list of all episodes airing in a given country on a given day
$tv->episodes->getSchedule("US", "2018-01-01");
Params:
String$countryAn ISO 3166-1 code of the countryDefualts to: US
String$dateAn ISO 8601 formatted dateDefualts to: <current date>
Returns an array of \TVMaze\Data\Episode objects or null
Get a list of all future episodes airing
$tv->episodes->getFullSchedule();
Returns an array of \TVMaze\Data\Episode objects or null
Get episode from a show by its season and episode number
$tv->episodes->getById($show = 82, $season = 2, $episode = 2);
Params:
Integer$showShow id
Integer$seasonSeason numberDefualts to: 1
Integer$episodeEpisode numberDefualts to: 1
Returns a \TVMaze\Data\Episode object or null
Get episodes from a show by the given date
$tv->episodes->getByDate($show = 335, $date = "2017-01-01");
Integer$showShow id
String$dateAn ISO 8601 formatted dateDefualts to: <current date>
Returns an array of \TVMaze\Data\Episode objects or null
Get a list of episodes for a season with a given id
$tv->episodes->getFromSeason(772);
Integer$seasonSeason id
Returns an array of \TVMaze\Data\Episode objects or null
#People
Search people by name
$tv->people->searchMany('Gordon');
String$nameName to look for
Returns an array of \TVMaze\Data\Person objects or null
Get a person by id
$tv->people->getById(40682, ['castcredits']);
Integer$personPerson id
Array$embedAn array of resources to embedDefaults to: An empty array
Returns a \TVMaze\Data\Person object or null
Get cast credits for a person with a given id
$tv->people->getCastCredits(40682, ['show']);
Integer$personPerson id
Array$embedAn array of resources to embedDefaults to: An empty array
Returns an array of \TVMaze\Data\CastCredit objects or null
Get crew credits for a person with a given id
$tv->people->getCrewCredits(40682, ['show']);
Integer$personPerson id
Array$embedAn array of resources to embedDefaults to: An empty array
Returns an array of \TVMaze\Data\CrewCredit objects or null
License
MIT