{"id":23722914,"url":"https://github.com/zero-to-prod/omdb","last_synced_at":"2025-10-29T13:19:07.046Z","repository":{"id":270380215,"uuid":"910183728","full_name":"zero-to-prod/omdb","owner":"zero-to-prod","description":"A PHP wrapper for the OMDb API with full object support","archived":false,"fork":false,"pushed_at":"2025-02-20T19:29:55.000Z","size":161,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T17:07:25.816Z","etag":null,"topics":["data-model","omdb","omdb-api","php"],"latest_commit_sha":null,"homepage":"https://zero-to-prod.github.io/omdb/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zero-to-prod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"zero-to-prod"}},"created_at":"2024-12-30T17:30:07.000Z","updated_at":"2025-03-17T10:17:38.000Z","dependencies_parsed_at":"2024-12-30T18:33:09.519Z","dependency_job_id":"f91c2d21-9601-4488-8784-7c8b90b29a14","html_url":"https://github.com/zero-to-prod/omdb","commit_stats":null,"previous_names":["zero-to-prod/omdb"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-to-prod%2Fomdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-to-prod%2Fomdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-to-prod%2Fomdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-to-prod%2Fomdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zero-to-prod","download_url":"https://codeload.github.com/zero-to-prod/omdb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480430,"owners_count":21110937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-model","omdb","omdb-api","php"],"created_at":"2024-12-30T23:58:19.887Z","updated_at":"2025-10-29T13:19:07.038Z","avatar_url":"https://github.com/zero-to-prod.png","language":"PHP","readme":"# Zerotoprod\\Omdb\n\n![](art/logo.png)\n\n[![Repo](https://img.shields.io/badge/github-gray?logo=github)](https://github.com/zero-to-prod/omdb)\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/zero-to-prod/omdb/test.yml?label=test)](https://github.com/zero-to-prod/omdb/actions)\n[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/zero-to-prod/omdb/backwards_compatibility.yml?label=backwards_compatibility)](https://github.com/zero-to-prod/omdb/actions)\n[![Packagist Downloads](https://img.shields.io/packagist/dt/zero-to-prod/omdb?color=blue)](https://packagist.org/packages/zero-to-prod/omdb/stats)\n[![Packagist Version](https://img.shields.io/packagist/v/zero-to-prod/omdb?color=f28d1a)](https://packagist.org/packages/zero-to-prod/omdb)\n[![License](https://img.shields.io/packagist/l/zero-to-prod/omdb?color=red)](https://github.com/zero-to-prod/omdb/blob/main/LICENSE.md)\n[![wakatime](https://wakatime.com/badge/github/zero-to-prod/omdb.svg)](https://wakatime.com/badge/github/zero-to-prod/omdb)\n[![Hits-of-Code](https://hitsofcode.com/github/zero-to-prod/omdb?branch=main)](https://hitsofcode.com/github/zero-to-prod/omdb/view?branch=main)\n\n## Contents\n\n- [Introduction](#introduction)\n- [TLDR](#tldr)\n- [Requirements](#requirements)\n    - [Getting an OMDb API Key](#getting-an-omdb-api-key)\n- [Installation](#installation)\n- [Documentation Publishing](#documentation-publishing)\n    - [Automatic Documentation Publishing](#automatic-documentation-publishing)\n- [Usage](#usage)\n    - [poster()](#poster)\n    - [byIdOrTitle()](#byidortitle)\n    - [search()](#search)\n    - [Factories](#factories)\n    - [Mocking](#mocking)\n- [Local Development](./LOCAL_DEVELOPMENT.md)\n- [Contributing](#contributing)\n\n## Introduction\n\n`Zerotoprod\\OmdbApi` is a PHP cURL wrapper for the [OMDb API](https://www.omdbapi.com/) with full object support.\nIt allows you to search for movies, series, and other media, retrieve detailed information using IMDb IDs or titles, and fetch poster images.\n\nIt wraps the [OmdbApi](https://github.com/zero-to-prod/omdb-api) and returns fully hydrated models using the\n[OmdbModels](https://github.com/zero-to-prod/omdb-models) package.\n\n## TLDR\n\n```php\nuse Zerotoprod\\Omdb\\Omdb;\n\n$Omdb = Omdb::from('apiKey');\n\n// Get the poster art of a title by its ImdbID\n$Omdb-\u003eposter('tt0499549'); // https://img.omdbapi.com/?apikey=8f8423aa\u0026i=tt0499549\n\n// Find a title by ImdbID (Internet Movie DataBase ID) or title\n$Omdb-\u003ebyIdOrTitle('Avatar')-\u003eTitle; // 2009\n\n// Find multiple titles\n$Omdb-\u003esearch('Avatar')-\u003eSearch['tt0499549']-\u003eYear; // 2009\n```\n\n## Requirements\n\n- PHP 8.1 or higher.\n- cURL extension enabled (typically enabled by default in most PHP installations).\n- A valid [OMDb API key](https://www.omdbapi.com/apikey.aspx). A free key is typically available.\n\n### Getting an OMDb API Key\n\n1. Go to the [OMDb API website](https://www.omdbapi.com/apikey.aspx).\n2. Sign up for a free or paid plan depending on your usage requirements.\n3. After registering, you will receive an API Key that you must pass to the OmdbApi class during initialization.\n\n## Installation\n\nInstall `Zerotoprod\\Omdb` via [Composer](https://getcomposer.org/):\n\n```shell\ncomposer require zero-to-prod/omdb\n```\n\nThis will add the package to your project's dependencies and create an autoloader entry for it.\n\n## Documentation Publishing\n\nYou can publish this README to your local documentation directory.\n\nThis can be useful for providing documentation for AI agents.\n\nThis can be done using the included script:\n\n```bash\n# Publish to default location (./docs/zero-to-prod/omdb)\nvendor/bin/zero-to-prod-omdb\n\n# Publish to custom directory\nvendor/bin/zero-to-prod-omdb /path/to/your/docs\n```\n\n### Automatic Documentation Publishing\n\nYou can automatically publish documentation by adding the following to your `composer.json`:\n\n```json\n{\n    \"scripts\": {\n        \"post-install-cmd\": [\n            \"zero-to-prod-omdb\"\n        ],\n        \"post-update-cmd\": [\n            \"zero-to-prod-omdb\"\n        ]\n    }\n}\n```\n\n## Usage\n\nInitialization:\n\n```php\nuse Zerotoprod\\Omdb\\Omdb;\n\n$Omdb = Omdb::from('apiKey');\n```\n\nYou can also customize the base URL and the poster URL if you need to (for example, to proxy through another service):\n\n```php\nuse Zerotoprod\\Omdb\\Omdb;\n\n$Omdb = Omdb::from(\n    apikey: 'apiKey',\n    base_url: 'https://www.omdbapi.com/',\n    img_url: 'https://img.omdbapi.com/'\n);\n```\n\n### poster()\n\nGet the poster art of a title by its ImdbID\n\n```php\n$Omdb-\u003eposter('tt0499549'); // https://img.omdbapi.com/?apikey=8f8423aa\u0026i=tt0499549\n```\n\n### byIdOrTitle()\n\nFind a title by ImdbID (Internet Movie DataBase ID) or title.\n\nReturns a [Title DataModel](https://github.com/zero-to-prod/omdb-models/blob/main/src/Title.php).\n\n```php\n$Omdb-\u003ebyIdOrTitle('Avatar')-\u003eTitle; // 2009\n```\n\n### search()\n\nFind multiple titles. Note the `imdbID` value is used as the key for each movie.\n\nReturns a [SearchResults DataModel](https://github.com/zero-to-prod/omdb-models/blob/main/src/SearchResults.php).\n\n```php\n$Omdb-\u003esearch('Avatar')-\u003eSearch['tt0499549']-\u003eYear; // 2009\n```\n\n### Factories\n\nYou can use the [provided factories](https://github.com/zero-to-prod/omdb-models#factories) without going through the api like this:\n\n```php\n\\Zerotoprod\\OmdbModels\\Factories\\TitleFactory::factory()-\u003esetTitle('Avatar')-\u003emake();\n```\n\n### Mocking\n\nYou can mock the api by implementing\nthe [Zerotoprod\\OmdbApi\\OmdbApiInterface](https://github.com/zero-to-prod/omdb-api/blob/main/src/OmdbApiInterface.php):\n\n```php\nuse Zerotoprod\\OmdbApi\\OmdbApiInterface;\nuse Zerotoprod\\Omdb\\Omdb;\n\nclass OmdbApiFake implements OmdbApiInterface\n{\n    public function search()\n}\n\n$Omdb = new Omdb(new OmdbApiFake());\n\n$Omdb-\u003esearch('Avatar');\n```\n\n## Contributing\n\nContributions, issues, and feature requests are welcome!\nFeel free to check the [issues](https://github.com/zero-to-prod/omdb/issues) page if you want to contribute.\n\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature-branch`).\n3. Commit changes (`git commit -m 'Add some feature'`).\n4. Push to the branch (`git push origin feature-branch`).\n5. Create a new Pull Request.\n","funding_links":["https://github.com/sponsors/zero-to-prod"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzero-to-prod%2Fomdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzero-to-prod%2Fomdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzero-to-prod%2Fomdb/lists"}