devvoh / tvmaze-api-client
TVmaze API Client is a wrapper to work with the TVMaze API
0.1.3
2017-08-29 11:21 UTC
Requires
- php: >=5.6
This package is auto-updated.
Last update: 2024-12-15 03:01:51 UTC
README
A very barebones API client, currently only intended to search for shows and get their information, including episodes. No crew list, etc. at this point.
Here's the example script:
$client = new TVmazeApi\Client(); $shows = $client->searchShow("firefl"); // Loop through the shows and show their id & name foreach ($shows as $show) { echo "#{$show->id}: {$show->name}\n"; } echo "\n"; // Get Firefly by id $show = $client->fetchShowById(180); echo "{$show->name} episodes:\n"; foreach ($client->fetchEpisodesByShowId($show->id) as $episode) { echo "{$episode->getNiceShortTag()} - {$episode->name}\n"; }
To get only the highest-scoring search result:
$client = new TVmazeApi\Client(); $show = $client->searchOneShow("firefl");
To get an array of matching search results:
$shows = $client->searchShow("firefl");
To get a show by its ID:
$show = $client->fetchShowById(180);
To get a show's episodes by the show's ID:
$show = $client->fetchShowById(180); $episodes = $client->fetchEpisodesByShowId($show->id);