2017 © Pedro Peláez
 

library thetvdb

API Client for thetvdb.com

image

adrenth/thetvdb

API Client for thetvdb.com

  • Thursday, February 25, 2016
  • by adrenth
  • Repository
  • 3 Watchers
  • 3 Stars
  • 56 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

adrenth/thetvdb

Build Status Latest Stable Version Total Downloads Latest Unstable Version License SensioLabsInsight, (*1)

This is an API client for the thetvdb.com website. It's using the XML feeds that are publicly available., (*2)

API Key Registration

To use this PHP package, you need to request an API Key from the thetvdb.com website: http://thetvdb.com/?tab=apiregister., (*3)

Please follow these guidelines:, (*4)

  • If you will be using the API information in a commercial product or website, you must email scott@thetvdb.com and wait for authorization before using the API. However, you MAY use the API for development and testing before a public release.
  • If you have a publicly available program, you MUST inform your users of this website and request that they help contribute information and artwork if possible.
  • You MUST familiarize yourself with our data structure, which is detailed in the wiki documentation.
  • You MUST NOT perform more requests than are necessary for each user. This means no downloading all of our content (we'll provide the database if you need it). Play nice with our server.
  • You MUST NOT directly access our data without using the documented API methods.
  • You MUST keep the email address in your account information current and accurate in case we need to contact you regarding your key (we hate spam as much as anyone, so we'll never release your email address to anyone else).
  • Please feel free to contact us and request changes to our site and/or API. We'll happily consider all reasonable suggestions.

Source: thetvdb.com, (*5)

API v2

There is also a version 2 of the API for which I also created a PHP client. See https://github.com/adrenth/thetvdb2., (*6)

Installation

Install this package using composer:, (*7)

$ composer require adrenth/thetvdb

Usage

Create a Client instance:, (*8)

$apiKey = 'yourapikey';
$cache = new \Doctrine\Common\Cache\FilesystemCache('path/to/cache');
$client = new Client($cache, $apiKey);

Cache

$client->setCacheTtl(3600); // in seconds

Language

$language = new Language('nl');

echo $language->getCode();
// 'nl'
echo $language->getLabel();
// 'Nederlands'

$language = $client->getUserPreferredLanguage($accountId);

Managing User Ratings

// Returns a UserFavoritesResponse
$favorites = $client->getUserFavorites($accountId);
$seriesIds = $favorites->getSeriesIds();

$favorites = $client->addUserFavorite($accountId, $seriesId);
$seriesIds = $favorites->getSeriesIds();

$favorites = $client->removeUserFavorite($accountId, $seriesId);
$seriesIds = $favorites->getSeriesIds();

Managing User Ratings

$rating = $client->addUserRatingForEpisode($accountId, $episodeId, $rating);
$rating = $client->removeUserRatingForEpisode($accountId, $episodeId);
$rating = $client->addUserRatingForSeries($accountId, $seriesId, $rating);
$rating = $client->removeUserRatingForSeries($accountId, $seriesId);

echo $rating->getUserRating();
// 7
echo $rating->getCommunityRating();
// 7.65

Searching / Fetching Series

$language = new Language('nl');
$response = $client->getSeries('Ray Donovan', $language, $accountId);
$seriesCollection = $response->getSeries();

foreach ($seriesCollection as $series) {
    echo $series->getName();
}

$response = $client->getSeriesByImdbId('tt0290978');
$response = $client->getSeriesByImdbId('tt0290978', new \Adrenth\Thetvdb\Language('de'));
$response = $client->getSeriesByZap2itId('EP01579745', new \Adrenth\Thetvdb\Language('nl'));

Caching

This package requires a Doctrine Cache instance. To disable caching (which I will never recommend!) just provide a VoidCache or ArrayCache instance., (*9)

For more information about Doctrine Cache visit https://github.com/doctrine/cache, (*10)

Contributing

Please contribute to make this package even better., (*11)

The Versions

25/02 2016

dev-master

9999999-dev http://github.com/adrenth/thetvdb

API Client for thetvdb.com

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alwin Drenth

api library thetvdb.com thetvdb

25/02 2016

0.1.8

0.1.8.0 http://github.com/adrenth/thetvdb

API Client for thetvdb.com

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alwin Drenth

api library thetvdb.com thetvdb

25/02 2016

dev-develop

dev-develop http://github.com/adrenth/thetvdb

API Client for thetvdb.com

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alwin Drenth

api library thetvdb.com thetvdb

19/02 2016

0.1.7

0.1.7.0 http://github.com/adrenth/thetvdb

API Client for thetvdb.com

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alwin Drenth

api library thetvdb.com thetvdb

19/01 2016

0.1.6

0.1.6.0 http://github.com/adrenth/thetvdb

API Client for thetvdb.com

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alwin Drenth

api library thetvdb.com thetvdb

15/01 2016

0.1.5

0.1.5.0 http://github.com/adrenth/thetvdb

API Client for thetvdb.com

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alwin Drenth

api library thetvdb.com thetvdb

16/10 2015

0.1.4

0.1.4.0 http://github.com/adrenth/thetvdb

API Client for thetvdb.com

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alwin Drenth

api library thetvdb.com thetvdb

07/10 2015

0.1.3

0.1.3.0 http://github.com/adrenth/thetvdb

API Client for thetvdb.com

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alwin Drenth

api library thetvdb.com thetvdb

24/09 2015

0.1.2

0.1.2.0 http://github.com/adrenth/thetvdb

API Client for thetvdb.com

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alwin Drenth

api library thetvdb.com thetvdb

24/09 2015

0.1.1

0.1.1.0 http://github.com/adrenth/thetvdb

API Client for thetvdb.com

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alwin Drenth

api library thetvdb.com thetvdb

24/09 2015

0.1

0.1.0.0 http://github.com/adrenth/thetvdb

API Client for thetvdb.com

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alwin Drenth

api library thetvdb.com thetvdb