devvoh / tvmaze-api-client
TVmaze API 客户端是一个用于操作 TVMaze API 的包装器
0.1.3
2017-08-29 11:21 UTC
Requires
- php: >=5.6
This package is auto-updated.
Last update: 2024-09-15 02:28:14 UTC
README
这是一个非常基础的 API 客户端,目前仅用于搜索电视剧及其信息,包括剧集。目前不包括制作人员列表等。
以下是示例脚本
$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");
通过 ID 获取电视剧
$show = $client->fetchShowById(180);
通过电视剧 ID 获取电视剧的剧集
$show = $client->fetchShowById(180); $episodes = $client->fetchEpisodesByShowId($show->id);