PHP code example of lsv / tvmazeapi

1. Go to this page and download the library: Download lsv/tvmazeapi 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/ */

    

lsv / tvmazeapi example snippets


use Lsv\TvmazeApi\Api\Show;

// Search for a show
$results = Show::getInstance()->search($query);
// $results = Lsv\TvmazeApi\Response\ShowResponse[]

// Search for a single show
$result = Show::getInstance()->singleSearch($query, true, true);
// $result = Lsv\TvmazeApi\Response\ShowResponse
// first true = Embed episodes
// second true = Embed next episode

// Find by tvmaze ID
$result = Show::getInstance()->findById($id, true, true);
// $result = Lsv\TvmazeApi\Response\ShowResponse
// first true = Embed episodes
// second true = Embed next episode

// Find by another sites ID
// Following methods can be used: lookupFromTvrage, lookupFromThetvdb or lookupFromImdb
$result = Show::getInstance()->lookupFromImdb($id);
// $result = Lsv\TvmazeApi\Response\ShowResponse
// first true = Embed episodes
// second true = Embed next episode