PHPackages                             aharen/omdbapi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. aharen/omdbapi

ActiveLibrary[API Development](/categories/api)

aharen/omdbapi
==============

PHP package for OMDbAPI.com by Brian Fritz

v2.1.3(2y ago)1126.7k↓11.1%61MITPHPPHP &gt;=7.2

Since Oct 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/aharen/OMDbAPI)[ Packagist](https://packagist.org/packages/aharen/omdbapi)[ RSS](/packages/aharen-omdbapi/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (14)Used By (1)

OMDbAPI
=======

[](#omdbapi)

PHP class to communicate with OMDbAPI.com API by Brian Fritz

How to Use
----------

[](#how-to-use)

Include the file

```
composer require aharen/omdbapi

```

Or update your composer.json file accordingly

```
require {
    "aharen/omdbapi" : "2.0.*"
}

```

### Initiating

[](#initiating)

Since the API will be going private ([read about it](https://www.patreon.com/posts/api-is-going-10743518)) &amp; would be requiring the API key, a small change has been made to how the API will be initiated and how the Poster API will be used.

```
use aharen\OMDbAPI();

$omdb = new OMDbAPI($api_key, $image_host, $assoc);
```

The first parameter will be the API Key, the secound is the host to use (false = omdbapi, true = poster api, false by default) &amp; third is assoc (true = assoc on, false = assoc off, false by default)

### Search OMDb API

[](#search-omdb-api)

Requires search keyword and accepts type (movie, series or episode) &amp; year

```
use aharen\OMDbAPI;

$omdb = new OMDbAPI();

$omdb->search($keyword, $type, $year);
```

Example usage

```
$omdb->search('spider');
```

Output

```
stdClass Object
(
    [code] => 200
    [message] => OK
    [data] => stdClass Object
        (
            [0] => stdClass Object
                (
                    [Title] => Spider-Man
                    [Year] => 2002
                    [imdbID] => tt0145487
                    [Type] => movie
                )

            [1] => stdClass Object
                (
                    [Title] => The Amazing Spider-Man
                    [Year] => 2012
                    [imdbID] => tt0948470
                    [Type] => movie
                )

            [2] => stdClass Object
                (
                    [Title] => Spider-Man 2
                    [Year] => 2004
                    [imdbID] => tt0316654
                    [Type] => movie
                )

            [3] => stdClass Object
                (
                    [Title] => Spider-Man 3
                    [Year] => 2007
                    [imdbID] => tt0413300
                    [Type] => movie
                )

            [4] => stdClass Object
                (
                    [Title] => The Amazing Spider-Man 2
                    [Year] => 2014
                    [imdbID] => tt1872181
                    [Type] => movie
                )

            [5] => stdClass Object
                (
                    [Title] => Along Came a Spider
                    [Year] => 2001
                    [imdbID] => tt0164334
                    [Type] => movie
                )

            [6] => stdClass Object
                (
                    [Title] => Spider
                    [Year] => 2002
                    [imdbID] => tt0278731
                    [Type] => movie
                )

            [7] => stdClass Object
                (
                    [Title] => Spider-Man
                    [Year] => 1994–1998
                    [imdbID] => tt0112175
                    [Type] => series
                )

            [8] => stdClass Object
                (
                    [Title] => Kiss of the Spider Woman
                    [Year] => 1985
                    [imdbID] => tt0089424
                    [Type] => movie
                )

            [9] => stdClass Object
                (
                    [Title] => The Spectacular Spider-Man
                    [Year] => 2008–2009
                    [imdbID] => tt0976192
                    [Type] => series
                )

        )

)
```

Usage examples

```
// search for all 'series' that contain 'spider' in the title
$omdb->search('spider', 'series');

// search for all 'series' that contain 'spider' in the title and is from '2014'
$omdb->search('spider', 'series', '2014');
```

### Associative mode

[](#associative-mode)

You can also use this library in associative mode, resulting in arrays instead of stdClass instances, passing the second constructor argument to true:

```
// Associative mode (results will be associative arrays)
$omdb = new OMDbAPI(null, true);

```

### Fetch movie details

[](#fetch-movie-details)

Fetch details of a movie, series or episode. details can be fetched by either IMDB ID or the Title

Usage example

```
// get details for IMDB ID 'tt0338013'
$omdb->fetch('i', 'tt0338013');

// get details for title 'eternal sunshine'
$omdb->fetch('t', 'eternal sunshine');
```

Output for both of the above queires

```
stdClass Object
(
    [code] => 200
    [message] => OK
    [data] => stdClass Object
        (
            [Title] => Eternal Sunshine of the Spotless Mind
            [Year] => 2004
            [Rated] => R
            [Released] => 19 Mar 2004
            [Runtime] => 108 min
            [Genre] => Drama, Romance, Sci-Fi
            [Director] => Michel Gondry
            [Writer] => Charlie Kaufman (story), Michel Gondry (story), Pierre Bismuth (story), Charlie Kaufman (screenplay)
            [Actors] => Jim Carrey, Kate Winslet, Gerry Robert Byrne, Elijah Wood
            [Plot] => When their relationship turns sour, a couple undergoes a procedure to have each other erased from their memories. But it is only through the process of loss that they discover what they had to begin with.
            [Language] => English
            [Country] => USA
            [Awards] => Won 1 Oscar. Another 64 wins & 62 nominations.
            [Poster] => http://ia.media-imdb.com/images/M/MV5BMTY4NzcwODg3Nl5BMl5BanBnXkFtZTcwNTEwOTMyMw@@._V1_SX300.jpg
            [Metascore] => 89
            [imdbRating] => 8.4
            [imdbVotes] => 533,088
            [imdbID] => tt0338013
            [Type] => movie
            [Response] => True
        )

)
```

### Fetching episodes details

[](#fetching-episodes-details)

You can also use the `fetch` third parameter to add extra parameters, for instance:

```
//                 Dexter (TV show)
$omdb->fetch('i', 'tt0773262', ['Season' => 1])
```

This will add the `Season=1` parameter

Credits
-------

[](#credits)

Unit Tests &amp; Associative Mode by [@Gregwar](https://github.com/Gregwar) (Cheers)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 70.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~217 days

Recently: every ~599 days

Total

13

Last Release

888d ago

PHP version history (2 changes)v2PHP &gt;=5.5.0

v2.1PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/d333321c93fc4a81308e6509aa4d350301054822054fe2a88e7b186b883f41a8?d=identicon)[aharen](/maintainers/aharen)

---

Top Contributors

[![aharen](https://avatars.githubusercontent.com/u/46440?v=4)](https://github.com/aharen "aharen (24 commits)")[![Gregwar](https://avatars.githubusercontent.com/u/367022?v=4)](https://github.com/Gregwar "Gregwar (4 commits)")[![bumbummen99](https://avatars.githubusercontent.com/u/4533331?v=4)](https://github.com/bumbummen99 "bumbummen99 (3 commits)")[![CicerBro](https://avatars.githubusercontent.com/u/177757655?v=4)](https://github.com/CicerBro "CicerBro (1 commits)")[![donwilson](https://avatars.githubusercontent.com/u/422444?v=4)](https://github.com/donwilson "donwilson (1 commits)")[![jjtbsomhorst](https://avatars.githubusercontent.com/u/583355?v=4)](https://github.com/jjtbsomhorst "jjtbsomhorst (1 commits)")

---

Tags

episodesmovieomdb-apiphpseriesmoviestv showsomdb api

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aharen-omdbapi/health.svg)

```
[![Health](https://phpackages.com/badges/aharen-omdbapi/health.svg)](https://phpackages.com/packages/aharen-omdbapi)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)[dariusiii/php-itunes-api

Query iTunes API System

1116.9k](/packages/dariusiii-php-itunes-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
