devmachine/guzzle-rottentomatoes-client

此包已被弃用,不再维护。未建议替代包。

用于 RottenTomatoes API 的 Guzzle 客户端 - http://developer.rottentomatoes.com。

1.0.1 2015-03-13 18:59 UTC

This package is not auto-updated.

Last update: 2020-01-16 08:41:27 UTC


README

Build Status

Guzzle 客户端用于 TottenTomatoes API。

描述

使用 Guzzle 4 编写的 RottenTomatoes 的简单客户端。由于 Guzzle Services 正在大力开发,因此此客户端不提供一些方便的特性,如 Guzzle 3 中存在的 资源迭代器(分页)。

安装

此库可以使用 Composer 安装。将以下内容添加到您的 composer.json 中

{
    "require": {
        "devmachine/guzzle-rottentomatoes-client": "1.0.*"
    }
}

示例用法

use Devmachine\Guzzle\RottenTomatoes\RottenTomatoesClient;

$client = RottenTomatoesClient::factory('<api-key>');
$result = $client->movies(['q' => 'Terminator 3']);

var_dump($result['movies']);

示例输出

array(1) {
  [0] =>
  array(13) {
    'id' =>
    string(5) "13049"
    'title' =>
    string(35) "Terminator 3 - Rise of the Machines"
    'year' =>
    int(2003)
    'mpaa_rating' =>
    string(1) "R"
    'runtime' =>
    int(109)
    'critics_consensus' =>
    string(112) "Although T3 never reaches the heights of the second movie, it is a welcome addition to the Terminator franchise."
    'release_dates' =>
    array(2) {
      'theater' =>
      string(10) "2003-12-31"
      'dvd' =>
      string(10) "2003-11-11"
    }
    'ratings' =>
    array(4) {
      'critics_rating' =>
      string(5) "Fresh"
      'critics_score' =>
      int(70)
      'audience_rating' =>
      string(7) "Spilled"
      'audience_score' =>
      int(47)
    }
    'synopsis' =>
    string(0) ""
    'posters' =>
    array(4) {
      'thumbnail' =>
      string(60) "http://content7.flixster.com/movie/10/94/47/10944773_mob.jpg"
      'profile' =>
      string(60) "http://content7.flixster.com/movie/10/94/47/10944773_pro.jpg"
      'detailed' =>
      string(60) "http://content7.flixster.com/movie/10/94/47/10944773_det.jpg"
      'original' =>
      string(60) "http://content7.flixster.com/movie/10/94/47/10944773_ori.jpg"
    }
    'abridged_cast' =>
    array(5) {
      ...
    }
    'alternate_ids' =>
    array(1) {
      'imdb' =>
      string(7) "0181852"
    }
    'links' =>
    array(6) {
      ...
    }
  }
}

API 方法

请使用 交互式文档 获取可用 API 端点及其对应参数的列表。以下您可以找到适当客户端方法的列表。

use Devmachine\Guzzle\RottenTomatoes\RottenTomatoesClient;

$client = RottenTomatoesClient::factory('<api-key>');

// Movies
$client->movies();
$client->moviesBoxOffice();
$client->moviesOpening();
$client->moviesInTheaters();
$client->moviesUpcoming();

// Individual movie
$client->movie();
$client->movieCast();
$client->movieClips();
$client->movieReviews();
$client->movieSimilar();
$client->movieAlias();

// DVDs
$client->dvdsTopRentals();
$client->dvdsCurrentReleases();
$client->dvdsNewReleases();
$client->dvdsUpcoming();

// Lists
$client->lists();
$client->listsMovies();
$client->listsDVDs();