1. Go to this page and download the library: Download marcwelp/laravel-tvdb 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/ */
marcwelp / laravel-tvdb example snippets
// Find a series by its TVDB ID
// ID: 73739 (Lost)
$result = TVDB::getSeries(73739);
echo $result->title; // "Lost"
// Search by title
$results = TVDB::search('Planet Earth');
// Search by IMDB ID
$results = TVDB::search(['imdbId' => 'tt5491994']);
// Search by zap2it ID
$results = TVDB::search(['zap2itId' => 'SH303483']);
/*
* Get the images of the series by TVDB ID
* ID: 73739 (Lost)
*
* Available image types:
* - TVDB::IMAGE_TYPE_FANART
* - TVDB::IMAGE_TYPE_POSTER
* - TVDB::IMAGE_TYPE_SEASON
* - TVDB::IMAGE_TYPE_SERIES
*/
$images = TVDB::getSeriesImages(73739, TVDB::IMAGE_TYPE_POSTER);
// Or get the images directly from a "Series" object
$series = TVDB::getSeries(73739);
$images = $series->getImages(TVDB::IMAGE_TYPE_FANART);
/*
* Get the actors of the series by TVDB ID
* ID: 73739 (Lost)
*/
$actors = TVDB::getSeriesActors(73739);
// Or get the actors directly from a "Series" object
$series = TVDB::getSeries(73739);
$actors = $series->getActors();
/*
* Get the episodes of the series by TVDB ID
* ID: 73739 (Lost)
*
* The second parameter specifies the page (page 1 by default)
*/
$episodes = TVDB::getSeriesEpisodes(73739, 2);
// Or get the episodes directly from a "Series" object
$series = TVDB::getSeries(73739);
$episodes = $series->getEpisodes(2);
$page = 1;
do {
$episodes = TVDB::getSeriesEpisodes(73739, $page);
echo "Page $page has " . count($episodes) . " episodes. <br />";
$page++;
} while($episodes->hasNextPage());
/*
* Output:
* Page 1 has 100 episodes.
* Page 2 has 49 episodes.
*/