PHP code example of devvoh / tvmaze-api-client

1. Go to this page and download the library: Download devvoh/tvmaze-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

devvoh / tvmaze-api-client example snippets


$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";
}

$client = new TVmazeApi\Client();

$show = $client->searchOneShow("firefl");

$shows = $client->searchShow("firefl");

$show = $client->fetchShowById(180);

$show = $client->fetchShowById(180);
$episodes = $client->fetchEpisodesByShowId($show->id);