Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Rotten Tomatoes Bridge

This library is a simple API wrapper around the Rotten Tomatoes API. It is built on the Guzzle HTTP library.

Development on this package is closed.

Installing via Composer

The recommended way to install this library is through Composer.

  1. Add palantirnet/rottentomatoes as a dependency in your project's composer.json file:

         "require": {
             "palantirnet/rottentomatoes": "1.0"
  2. Download and install Composer:

     curl -s | php
  3. Install your dependencies:

     php composer.phar install
  4. Require Composer's autoloader

    Composer also prepares an autoload file that's capable of autoloading all of the classes in any of the libraries that it downloads. To use it, just add the following line to your code's bootstrap process:

     require 'vendor/autoload.php';

You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at

Using the library

To connect to Rotten Tomatoes, you need an API key issued by them. It is a simple pseudorandom alphanumeric string. You can register for one on the [Rotten Tomatoes Developer site][]

Once you have the key, the rest is easy:


use Guzzle\RottenTomatoes\RottenTomatoesClient;
use PalantirNet\RottenTomatoes\Connection;

$apikey = 'the API key from Rotten Tomatoes';

// You could use an alternate URI if you wanted to use a mock server or proxy
// or something like that.
$base_uri = '';

$connection = new Connection(new RottenTomatoesClient($base_uri, array('apikey' => $apikey)));

Congratulations, you now have a connection to Rotten Tomatoes! You can look up movies and reviews with the appropriate methods:


$movie1 = $connection->getMovieById($rotten_tomatoes_id_of_a_movie);
$movie2 = $connection->getMovieByImdbId($imdb_id_of_a_movie);

In either case, you get back a \PalantirNet\RottenTomatoes\Movie object.

Note: IMDB IDs often have leading zeros, so if you're providing a literal ID be careful that it doesn't get interpreted as an octal number. That is, don't do this:

$connection->getMoviebyImdbId(01234); // Don't do this!

Because PHP will interpret that as "1234" in base 8 (Octal). Instead, quote the ID:


Movies can be used to retrieve related Reviews, as well as related cast data. Those have their own objects. (See the inline documentation.)

The raw data of a movie (or review) can be retrieved as an array with the getData() method. There are also a small number of utility methods available. (PRs for more will be accepted!)

$movie = $connection->getMoviebyImdbId('01234');
$title = $movie->title();
$data = $movie->getData();


API bridge for connecting to the Rotten Tomatoes API







No packages published