hmerritt / imdb-api
IMDB API that can fetch film data and search results
Installs: 9 189
Dependents: 0
Suggesters: 0
Security: 0
Stars: 59
Watchers: 2
Forks: 21
Open Issues: 2
Type:project
Requires
- php: >=7.1
- paquettg/php-html-parser: ^2.1
- predis/predis: ^2.2
- tmarois/filebase: ^1.0
Requires (Dev)
- php-coveralls/php-coveralls: 2.5.2
- phpunit/phpunit: 9.5.16
README
PHP IMDB-API that can fetch film data and search results.
Install
Install the latest version using composer.
$ composer require hmerritt/imdb-api
Usage
// Assuming you installed from Composer: require "vendor/autoload.php"; use hmerritt\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
$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
- Genres
- Year
- Length
- Plot
- Rating
- Rating Votes (# of votes)
- Poster
- Trailer
- id
- link
- Cast
- actor name
- actor id
- character
- avatar
- avatar_hq (high quality avatar)
- Technical Specs
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
.