Download the PHP package mfonte/imdb-scraper without Composer

On this page you can find all versions of the php package mfonte/imdb-scraper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package imdb-scraper

Mfonte IMDb Scraper

A PHP library for scraping movie and TV show data from IMDb with ease. This package provides methods to retrieve detailed information about movies and TV shows using best matches or strict year-based queries, with support for localized searches.

[!CAUTION] This package is intended for educational and personal use only. Users are responsible for ensuring their use complies with IMDb's Terms of Service and applicable laws. The author does not condone or encourage unauthorized scraping or other activities that violate legal agreements. Please, refer to the IMDb Conditions of Use for more information. It is your responsibility to use this package in compliance with IMDb's Terms of Service.

List of supported locales

Overview

Mfonte IMDb Scraper is a lightweight, object-oriented library to interact with IMDb. It provides functionalities to:

Key features include:

Installation

Release tag v1 is compatible with PHP versions 7.3, 7.4 and 8.0 (monolog ^2.0).

Install the package via Composer:

Release tag v2 is compatible with PHP versions 8.1, 8.2, 8.3, 8.4 (monolog ^3.0).

Install the package via Composer:


Usage

Basic Example

All methods return a Mfonte\ImdbScraper\Title object with the following properties.

The Title Object

The Title object represents detailed information about a movie or TV show fetched using the ImdbScraper library. It encapsulates all key attributes of a title, including metadata, cast, genres, and links to related content.

Properties of the Title Object

Property Type Description
id string The unique IMDb ID of the title (e.g., "tt1234567").
isTvSeries bool Indicates whether the title is a TV series (true) or a movie (false).
link string The URL of the IMDb page for the title.
title string The official title of the movie or TV show.
originalTitle string The original title of the movie or TV show.
year `int | null`
length `string | null`
rating `float | null`
ratingVotes `int | null`
popularityScore `int | null`
metaScore `int | null`
genres array A list of genres associated with the title (e.g., ["Action", "Drama"]).
posterUrl `string | null`
trailerUrl `string | null`
plot `string | null`
actors Dataset A dataset containing the cast members of the title. (Person objects)
similars Dataset A dataset containing similar titles to the one fetched. (Title objects)
seasonRefs array A list of season numbers for a TV series (e.g., [1, 2, 3, 4]).
seasons Dataset A dataset containing detailed information about seasons for a TV series. (Season objects)
metadata array Raw metadata associated with the title.

Options

The scraper provides various configuration options during initialization:

Option Default Description
cache false Enables caching of results.
locale en Sets the locale for searches (e.g., it for Italian).
seasons false If true, fetches season data for TV shows.
guzzleLogFile null File path for logging HTTP requests (useful for debugging).

Example: Setting Options


Methods

Best Match Overview

The movie() and tvSeries() methods find the best match for a given title. The library uses a Levenshtein algorithm to rank results and selects the closest match.

Example with movie()


By Year Overview

The movieByYear() and tvSeriesByYear() methods perform a strict search for titles matching the specified year. If no exact match is found, the library checks for movies released one year before or after the given year.

Example with movieByYear()


Handling Exceptions in movie(), tvSeries(), movieByYear(), and tvSeriesByYear()

The methods movie(), tvSeries(), movieByYear(), and tvSeriesByYear() in the Imdb class throw exceptions when specific conditions are not met during the search:

  1. NoSearchResults Exception:

    • Thrown when no results are found for the provided query.
    • Example:
  2. MultipleSearchResults Exception:

    • Thrown when the query returns multiple results but the method cannot narrow them down to a single title.
    • Example:
  3. BadMethodCall Exception:
    • Thrown when invalid input is provided to the id() method or other API methods.
    • Example:

The id() Method

The id() method allows you to fetch detailed information about a movie or TV show using its unique IMDb ID.

Key Features:

The search() Method

The search() method performs a general search query and returns a Dataset containing SearchResult objects for all matches.

Key Features:

Summary of Exceptions and Methods

Method Description Exceptions Thrown
movie($title) Fetches the best match for a movie title. NoSearchResults, MultipleSearchResults
tvSeries($title) Fetches the best match for a TV series title. NoSearchResults, MultipleSearchResults
movieByYear($title, $year) Fetches a movie by title and year. NoSearchResults, MultipleSearchResults
tvSeriesByYear($title, $year) Fetches a TV series by title and year. NoSearchResults, MultipleSearchResults
id($imdbId) Fetches a movie or TV show by IMDb ID (e.g., tt1234567). BadMethodCall
search($query) Performs a general search and returns a Dataset of SearchResult objects. -

With these robust exception-handling mechanisms and versatile methods, the Imdb class offers both flexibility and reliability for your IMDb scraping needs.

Advanced Features

Caching

Enable caching for faster repeated lookups. Cache works seamlessly and stores results locally.

Locale

Retrieve localized movie titles, plots, and other data by setting the locale option.


Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.


License

This project is licensed under the MIT License. See the LICENSE file for details.


All versions of imdb-scraper with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
paquettg/php-html-parser Version ^3.0
monolog/monolog Version ^3.8
voku/simple-cache Version ^4.1
voku/simple_html_dom Version ^4.8
voku/portable-utf8 Version ^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mfonte/imdb-scraper contains the following files

Loading the files please wait ....