adrenth / tvrage
此包已被废弃且不再维护。未建议替换包。
tvrag.com API 客户端
0.1.2
2015-09-12 08:09 UTC
Requires
- php: >=5.5
- doctrine/cache: ^1.4
- guzzlehttp/guzzle: ^6.0
- symfony/serializer: ^2.7
Requires (Dev)
- phpunit/phpunit: ^4.8
This package is auto-updated.
Last update: 2020-05-23 14:42:18 UTC
README
这是 tvrage.com 网站的 API 客户端。它使用公开可用的 XML 流。更多详情请访问 http://services.tvrage.com/info.php?page=main。
安装
使用 Composer 安装此包
composer require adrenth/tvrage
缓存
由于 tvrage.com 的 XML 流通常非常慢,我建议您使用缓存。此包需要一个 Doctrine Cache
实例。
要禁用缓存,只需提供 VoidCache
或 ArrayCache
实例。
有关 Doctrine 缓存的更多信息,请访问 https://github.com/doctrine/cache
使用
<?php
require '../vendor/autoload.php';
$cache = new \Doctrine\Common\Cache\FilesystemCache('path/to/temp');
$client = new Adrenth\Tvrage\Client($cache);
// Search TV-serie Top Gear
$response = $client->search('top gear'); // ShowsResponse
// Perform a full search on Ray Donovan
$response = $client->fullSearch('ray donovan'); // ShowsResponse
// Get (full) show info by passing the tvrageid (Buffy the Vampire Slayer)
$response = $client->showInfo(2930); // ShowResponse
$response = $client->fullShowInfo(2930); // ShowResponse
// Get Episode list of Buffy the Vampire Slayer
$response = $client->episodeList(2930); // SeasonsResponse
// Get Episode infor of Buffy the Vampire Slayer (season 2, episode 4)
$response = $client->episodeInfo(2930, 2, 4); // EpisodeResponse
SeasonsResponse
;包含 0 或多个Season
实例(episodeList)EpisodeResponse
;包含 0 或 1 个Episode
实例(episodeInfo)ShowResponse
;包含 0 或 1 个Show
实例(showInfo)ShowsResponse
;包含 0 或多个Show
实例(search,fullSearch)
贡献
请为此包做出贡献,使其更加完善。