PHPackages                             zero-to-prod/omdb - 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. zero-to-prod/omdb

ActiveLibrary[API Development](/categories/api)

zero-to-prod/omdb
=================

A PHP wrapper for the OMDb API with full object support

v1.1.0(8mo ago)491[1 PRs](https://github.com/zero-to-prod/omdb/pulls)MITPHPPHP &gt;=8.1.0CI passing

Since Dec 31Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/zero-to-prod/omdb)[ Packagist](https://packagist.org/packages/zero-to-prod/omdb)[ Docs](https://github.com/zero-to-prod/omdb)[ Fund](https://github.com/sponsors/zero-to-prod)[ RSS](/packages/zero-to-prod-omdb/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (7)Versions (7)Used By (0)

Zerotoprod\\Omdb
================

[](#zerotoprodomdb)

[![](art/logo.png)](art/logo.png)

[![Repo](https://camo.githubusercontent.com/9a90a3efeee26aed7d7f2feee9cd84566a26f9c362cc773b184d076210906e1c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746875622d677261793f6c6f676f3d676974687562)](https://github.com/zero-to-prod/omdb)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/af587a0371f2a7c13437e80d42dfef4c7b976474a25a5304f756c64303d31497/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f6f6d64622f746573742e796d6c3f6c6162656c3d74657374)](https://github.com/zero-to-prod/omdb/actions)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/4429fe80eac828ef2db837dc1d919594787f53832532200ac415f1d64bf470d2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7a65726f2d746f2d70726f642f6f6d64622f6261636b77617264735f636f6d7061746962696c6974792e796d6c3f6c6162656c3d6261636b77617264735f636f6d7061746962696c697479)](https://github.com/zero-to-prod/omdb/actions)[![Packagist Downloads](https://camo.githubusercontent.com/c9b67164866e3fc4f01b54efd9d3ad85b49279abbe9ccc659f320e532468c887/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a65726f2d746f2d70726f642f6f6d64623f636f6c6f723d626c7565)](https://packagist.org/packages/zero-to-prod/omdb/stats)[![Packagist Version](https://camo.githubusercontent.com/9b750f2ea0410325369b6e331bdc69e52d599e4fbc999264f0eb7861ed8947d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a65726f2d746f2d70726f642f6f6d64623f636f6c6f723d663238643161)](https://packagist.org/packages/zero-to-prod/omdb)[![License](https://camo.githubusercontent.com/41c22ecd1781e197d896054fcfcd6b3cca8c08f926a102c7be539d6c6cd03dde/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a65726f2d746f2d70726f642f6f6d64623f636f6c6f723d726564)](https://github.com/zero-to-prod/omdb/blob/main/LICENSE.md)[![wakatime](https://camo.githubusercontent.com/a37f3f42e817170ac431ace4e71d77ba818bdeec237c34e4af2a04fe276e8456/68747470733a2f2f77616b6174696d652e636f6d2f62616467652f6769746875622f7a65726f2d746f2d70726f642f6f6d64622e737667)](https://wakatime.com/badge/github/zero-to-prod/omdb)[![Hits-of-Code](https://camo.githubusercontent.com/02eec9a13f36a4bdd11bd511290ca170450c9f560296a1e668851da11dae9935/68747470733a2f2f686974736f66636f64652e636f6d2f6769746875622f7a65726f2d746f2d70726f642f6f6d64623f6272616e63683d6d61696e)](https://hitsofcode.com/github/zero-to-prod/omdb/view?branch=main)

Contents
--------

[](#contents)

- [Introduction](#introduction)
- [TLDR](#tldr)
- [Requirements](#requirements)
    - [Getting an OMDb API Key](#getting-an-omdb-api-key)
- [Installation](#installation)
- [Documentation Publishing](#documentation-publishing)
    - [Automatic Documentation Publishing](#automatic-documentation-publishing)
- [Usage](#usage)
    - [poster()](#poster)
    - [byIdOrTitle()](#byidortitle)
    - [search()](#search)
    - [Factories](#factories)
    - [Mocking](#mocking)
- [Local Development](./LOCAL_DEVELOPMENT.md)
- [Contributing](#contributing)

Introduction
------------

[](#introduction)

`Zerotoprod\OmdbApi` is a PHP cURL wrapper for the [OMDb API](https://www.omdbapi.com/) with full object support. It allows you to search for movies, series, and other media, retrieve detailed information using IMDb IDs or titles, and fetch poster images.

It wraps the [OmdbApi](https://github.com/zero-to-prod/omdb-api) and returns fully hydrated models using the [OmdbModels](https://github.com/zero-to-prod/omdb-models) package.

TLDR
----

[](#tldr)

```
use Zerotoprod\Omdb\Omdb;

$Omdb = Omdb::from('apiKey');

// Get the poster art of a title by its ImdbID
$Omdb->poster('tt0499549'); // https://img.omdbapi.com/?apikey=8f8423aa&i=tt0499549

// Find a title by ImdbID (Internet Movie DataBase ID) or title
$Omdb->byIdOrTitle('Avatar')->Title; // 2009

// Find multiple titles
$Omdb->search('Avatar')->Search['tt0499549']->Year; // 2009
```

Requirements
------------

[](#requirements)

- PHP 8.1 or higher.
- cURL extension enabled (typically enabled by default in most PHP installations).
- A valid [OMDb API key](https://www.omdbapi.com/apikey.aspx). A free key is typically available.

### Getting an OMDb API Key

[](#getting-an-omdb-api-key)

1. Go to the [OMDb API website](https://www.omdbapi.com/apikey.aspx).
2. Sign up for a free or paid plan depending on your usage requirements.
3. After registering, you will receive an API Key that you must pass to the OmdbApi class during initialization.

Installation
------------

[](#installation)

Install `Zerotoprod\Omdb` via [Composer](https://getcomposer.org/):

```
composer require zero-to-prod/omdb
```

This will add the package to your project's dependencies and create an autoloader entry for it.

Documentation Publishing
------------------------

[](#documentation-publishing)

You can publish this README to your local documentation directory.

This can be useful for providing documentation for AI agents.

This can be done using the included script:

```
# Publish to default location (./docs/zero-to-prod/omdb)
vendor/bin/zero-to-prod-omdb

# Publish to custom directory
vendor/bin/zero-to-prod-omdb /path/to/your/docs
```

### Automatic Documentation Publishing

[](#automatic-documentation-publishing)

You can automatically publish documentation by adding the following to your `composer.json`:

```
{
    "scripts": {
        "post-install-cmd": [
            "zero-to-prod-omdb"
        ],
        "post-update-cmd": [
            "zero-to-prod-omdb"
        ]
    }
}
```

Usage
-----

[](#usage)

Initialization:

```
use Zerotoprod\Omdb\Omdb;

$Omdb = Omdb::from('apiKey');
```

You can also customize the base URL and the poster URL if you need to (for example, to proxy through another service):

```
use Zerotoprod\Omdb\Omdb;

$Omdb = Omdb::from(
    apikey: 'apiKey',
    base_url: 'https://www.omdbapi.com/',
    img_url: 'https://img.omdbapi.com/'
);
```

### poster()

[](#poster)

Get the poster art of a title by its ImdbID

```
$Omdb->poster('tt0499549'); // https://img.omdbapi.com/?apikey=8f8423aa&i=tt0499549
```

### byIdOrTitle()

[](#byidortitle)

Find a title by ImdbID (Internet Movie DataBase ID) or title.

Returns a [Title DataModel](https://github.com/zero-to-prod/omdb-models/blob/main/src/Title.php).

```
$Omdb->byIdOrTitle('Avatar')->Title; // 2009
```

### search()

[](#search)

Find multiple titles. Note the `imdbID` value is used as the key for each movie.

Returns a [SearchResults DataModel](https://github.com/zero-to-prod/omdb-models/blob/main/src/SearchResults.php).

```
$Omdb->search('Avatar')->Search['tt0499549']->Year; // 2009
```

### Factories

[](#factories)

You can use the [provided factories](https://github.com/zero-to-prod/omdb-models#factories) without going through the api like this:

```
\Zerotoprod\OmdbModels\Factories\TitleFactory::factory()->setTitle('Avatar')->make();
```

### Mocking

[](#mocking)

You can mock the api by implementing the [Zerotoprod\\OmdbApi\\OmdbApiInterface](https://github.com/zero-to-prod/omdb-api/blob/main/src/OmdbApiInterface.php):

```
use Zerotoprod\OmdbApi\OmdbApiInterface;
use Zerotoprod\Omdb\Omdb;

class OmdbApiFake implements OmdbApiInterface
{
    public function search()
}

$Omdb = new Omdb(new OmdbApiFake());

$Omdb->search('Avatar');
```

Contributing
------------

[](#contributing)

Contributions, issues, and feature requests are welcome! Feel free to check the [issues](https://github.com/zero-to-prod/omdb/issues) page if you want to contribute.

1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Commit changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature-branch`).
5. Create a new Pull Request.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance60

Regular maintenance activity

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~60 days

Total

5

Last Release

259d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/502649f05d36c87d494988bd99193a4d908d345335d99c080928a726277371f5?d=identicon)[zero-to-prod](/maintainers/zero-to-prod)

---

Top Contributors

[![zero-to-prod](https://avatars.githubusercontent.com/u/61474950?v=4)](https://github.com/zero-to-prod "zero-to-prod (13 commits)")

---

Tags

data-modelomdbomdb-apiphpomdbzero-to-prodOpen Movie Database

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zero-to-prod-omdb/health.svg)

```
[![Health](https://phpackages.com/badges/zero-to-prod-omdb/health.svg)](https://phpackages.com/packages/zero-to-prod-omdb)
```

###  Alternatives

[zero-to-prod/data-model

Transforms Data into Type-Safe DTOs.

14226.2k32](/packages/zero-to-prod-data-model)

PHPackages © 2026

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