zvenn/api-imdb-streaming-movies

IMDB API that can fetch film data and search results also streaming movies

dev-master 2021-11-22 22:51 UTC

This package is auto-updated.

Last update: 2024-04-23 04:52:27 UTC


README

Latest Stable Version Build Status Coverage Status

PHP imdb-api-streaming-movies that can fetch film data and search results.

forked from hmerritt/imdb-api package with adding some custom functionalities

Install

Install the latest version using composer.

$ composer require zvenn/api-imdb-streaming-movies

Usage

// Assuming you installed from Composer:
require "vendor/autoload.php";
use zvenn\Imdb;

$imdb = new Imdb;

// Search imdb
// -> returns array of films and people found
$imdb->search("Apocalypse");

// Get film data
// -> returns array of film data (title, year, rating...)
$imdb->film("tt0816692");

Options

Name Type Default Value Description
curlHeaders array ['Accept-Language: en-US,en;q=0.5'] Custom headers can be passed to cURL when fetching the IMDB page
cache bool true Caches film data to speed-up future requests for the same film
techSpecs bool true Loads a films technical specifications (this will take longer as it makes a separate request)
category string all What category to search for (films tt, people nm or companies co)
$imdb = new Imdb;

//  Options are passed as an array as the second argument
//  These are the default options
$imdb->film("tt0816692", [
    'cache'        => true,
    'curlHeaders'  => ['Accept-Language: en-US,en;q=0.5'],
    'techSpecs'    => true,
]);

$imdb->search("Interstellar", [
    'category'     => 'all',
    'curlHeaders'  => ['Accept-Language: en-US,en;q=0.5'],
]);

Best Match

If you do not know the imdb-id of a film, a search string can be entered. This will search imdb and use the first result as the film to fetch data for.

Note that this will take longer than just entering the ID as it needs to first search imdb before it can get the film data.

// Searches imdb and gets the film data of the first result
// -> will return the film data for 'Apocalypse Now'
$imdb->film("Apocalypse");

Features

Film Data

- Title
- Year
- Rating
- Poster
- Length
- Plot
- Trailer
    - id
    - link
- Cast
    - actor name
    - actor id
    - image
- Technical Specs
- Movies

Search

Search IMDB to return an array of films, people and companies

- Films
    - id
    - title
    - image
- People
    - id
    - name
    - image
- Companies
    - id
    - name
    - image

Dependencies

All dependencies are managed automatically by composer.

imdb-api-streaming-movies