{"id":36986222,"url":"https://github.com/vfalies/tmdb","last_synced_at":"2026-01-13T23:04:09.508Z","repository":{"id":47632844,"uuid":"93059970","full_name":"vfalies/tmdb","owner":"vfalies","description":"PHP Wrapper for TMDB (The Movie DataBase) API V3","archived":false,"fork":false,"pushed_at":"2021-08-20T14:21:39.000Z","size":941,"stargazers_count":22,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-27T16:42:52.068Z","etag":null,"topics":["api-wrapper","library","movie","movie-database","php-wrapper","php7-1","php7-2","php7-3","tmdb","wrapper"],"latest_commit_sha":null,"homepage":"https://vfac.fr/projects/tmdb","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/vfalies.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-01T13:26:21.000Z","updated_at":"2024-07-26T18:25:17.000Z","dependencies_parsed_at":"2022-08-24T12:50:51.733Z","dependency_job_id":null,"html_url":"https://github.com/vfalies/tmdb","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/vfalies/tmdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfalies%2Ftmdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfalies%2Ftmdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfalies%2Ftmdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfalies%2Ftmdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vfalies","download_url":"https://codeload.github.com/vfalies/tmdb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfalies%2Ftmdb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api-wrapper","library","movie","movie-database","php-wrapper","php7-1","php7-2","php7-3","tmdb","wrapper"],"created_at":"2026-01-13T23:04:09.428Z","updated_at":"2026-01-13T23:04:09.497Z","avatar_url":"https://github.com/vfalies.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tmdb - PHP Wrapper for The Movie Database API V3\n\n[![Latest Stable Version](https://poser.pugx.org/vfalies/tmdb/version)](https://packagist.org/packages/vfalies/tmdb) [![Build Status](https://scrutinizer-ci.com/g/vfalies/tmdb/badges/build.png?b=master)](https://scrutinizer-ci.com/g/vfalies/tmdb/build-status/master) [![Code Coverage](https://scrutinizer-ci.com/g/vfalies/tmdb/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/vfalies/tmdb/?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/vfalies/tmdb/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/vfalies/tmdb/?branch=master) [![License](https://poser.pugx.org/vfalies/tmdb/license)](https://packagist.org/packages/vfalies/tmdb)\n\n![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/vfalies/tmdb)\n[![Tested on PHP 7.1 to 8.0](https://img.shields.io/badge/tested%20on-PHP%207.1%20|%207.2%20|%207.3%20|%207.4%20|%208.0%20-brightgreen.svg?maxAge=2419200)](https://github.com/vfalies/tmdb/actions/workflows/php.yml)\n\nTmdb is a PHP wrapper for [The Movie Database](https://www.themoviedb.org/) API [V3](https://developers.themoviedb.org).\n\n## Table of contents\n\n1. [Features](#features)\n2. [Installation](#installation)\n3. [Basic usage](#basic-usage)\n4. [Usage](#usage)\n    1. [Getting a TMDB instance](#getting-a-tmdb-instance)\n    2. [Movie](#movie)\n    3. [TV Show](#tv-show)\n    4. [Collection](#collection)\n    5. [People](#people)\n    6. [Company](#company)\n    7. [Find by an external ID](#find)\n    8. [Authentication](#authentication)\n    9. [Media Helper](#media-helper)\n5. [Unit tests](#unit-tests)\n6. [About](#about)\n\n## Features\u003ca name=\"features\"\u003e\u003c/a\u003e\n\nFeatures actualy supported :\n\n- Search\n  - Movie\n  - TV Show\n  - Collection\n  - Company\n- Getting informations\n  - Movie\n  - TV Show\n  - Collection\n  - Company\n  - Genres\n  - TV Network\n- Account\n  - Authentification\n  - Movies / TV Shows rating\n  - Movies / TV Shows favorites\n  - Movies / TV Shows watchlist\n- Media\n- Genres\n- Jobs\n- Find\n  - IMDb\n  - TheTVDb\n  - TVRage\n  - Facebook\n  - Twitter\n  - Instagram\n\n## Installation\u003ca name=\"installation\"\u003e\u003c/a\u003e\n\n### Requirements\n\n- Tmdb works with PHP 7.1 and higher\n- TheMovieDatabase API key\n\n### Composer\n\nInstall the lastest version with\n\n```bash\n$ composer require vfalies/tmdb\n```\n\n## Basic Usage\u003ca name=\"basic-usage\"\u003e\u003c/a\u003e\n\n```php\n\u003c?php\n\nrequire 'vendor/autoload.php';\n\nuse VfacTmdb\\Factory;\nuse VfacTmdb\\Search;\nuse VfacTmdb\\Item;\n\n// Initialize Wrapper\n$tmdb = Factory::create()-\u003egetTmdb('your_api_key');\n\n// Search a movie\n$search    = new Search($tmdb);\n$responses = $search-\u003emovie('star wars');\n\n// Get all results\nforeach ($responses as $response)\n{\n    echo $response-\u003egetTitle();\n}\n\n// Get movie information\n$item  = new Item($tmdb);\n$infos = $item-\u003egetMovie(11, array('language' =\u003e 'fr-FR'));\n\necho $infos-\u003egetTitle();\n```\n\n## Usage\n\n### Getting a TMDB instance\u003ca name=\"getting-a-tmdb-instance\"\u003e\u003c/a\u003e\n\n`TMDB` is the main class of the library.\nIt has two dependencies :\n- a API key from [The Movie DataBase website](https://www.themoviedb.org/)\n- a `Psr\\Log\\LoggerInterface` instance to write logs\n\n#### Using the Factory\n\nIt is the easiest way to load TMDB\n\n```php\n\u003c?php\nrequire 'vendor/autoload.php';\n\nuse VfacTmdb\\Factory;\n\n$tmdb = Factory::create()-\u003egetTmdb('your_api_key');\n```\n\n#### In a Slim application\n\nIf your application is built with [Slim](https://www.slimframework.com/), you can add TMDB in your dependencies and inject Slim's [Monolog](https://seldaek.github.io/monolog/) instance into it.\nJust add this in `dependencies.php`\n\n```php\n$container['tmdb'] = function ($c) {\n    $api_key = $c-\u003eget('settings')['tmdb']['api_key'];\n    $tmdb = new \\vfalies\\tmdb\\Tmdb($api_key, $c-\u003elogger);\n}\n```\n\nIn this example, API key is declared in `settings.php`\n\n```php\nreturn [\n    'settings' = [\n        'tmdb' = [\n            'api_key' = 'your_api_key';\n        ]\n    ]\n];\n```\n\n#### Do it yourself\n\nConvenient if you need too inject your own dependencies. In the example below, we inject [Monolog](https://seldaek.github.io/monolog/) configured to write logs on standards output.\n\n```php\n\u003c?php\nrequire 'vendor/autoload.php';\n\nuse VfacTmdb\\Tmdb;\nuse Monolog\\Logger;\nuse Monolog\\Handler\\StreamHandler;\n\n$logger = new Logger('default', [new StreamHandler('php://stdout')])\n\n$tmdb = Tmdb('your_api_key', $logger);\n```\n\n### Movie\u003ca name=\"movie\"\u003e\u003c/a\u003e\n\n#### Search a movie\n\n```php\n$search    = new Search($tmdb);\n$responses = $search-\u003emovie('star wars');\n```\n\nThe search returns [`Generator`](http://php.net/manual/en/class.generator.php) object of [`Result\\Movie`](/public/docs/tmdb/class-VfacTmdb.Results.Movie.html) object.\n\n[See demo](https://vfac.fr/projects/tmdb/demo/search-movie)\n\n#### Get a movie\n\n```php\n$item  = new Item($tmdb);\n$movie = $item-\u003egetMovie($movie_id);\n\necho $movie-\u003egetTitle();\n```\n\nThe getter returns a [`Movie`](/public/docs/tmdb/class-VfacTmdb.Items.Movie.html) object.\n\n[See demo](https://vfac.fr/projects/tmdb/demo/get-movie-details)\n\n### TV Show\u003ca name=\"tv-show\"\u003e\u003c/a\u003e\n\n#### Search a TV Show\n\n```php\n$search    = new Search($tmdb);\n$responses = $search-\u003etvshow('game of thrones');\n```\n\nThe search returns [`Generator`](http://php.net/manual/en/class.generator.php) object of [`Result\\TVShow`](/public/docs/tmdb/class-VfacTmdb.Results.TVShow.html) object.\n\n[See demo](https://vfac.fr/projects/tmdb/demo/search-tvshow)\n\n#### Get a TV Show\n\n```php\n$item   = new Item($tmdb);\n$tvshow = $item-\u003egetTVShow($tvshow_id);\n\necho $tvshow-\u003egetTitle();\n```\n\nThe getter returns a [`TVShow`](/public/docs/tmdb/class-VfacTmdb.Items.TVShow.html) object.\n\n[See demo](https://vfac.fr/projects/tmdb/demo/search-tvshow_details)\n\n#### Get a TV Season\n\n```php\n$item     = new Item($tmdb);\n$tvseason = $item-\u003egetTVSeason($tvshow_id, $season_number);\n\necho $tvseason-\u003egetName();\n```\n\nThe getter returns a [`TVSeason`](/public/docs/tmdb/class-VfacTmdb.Items.TVSeason.html) object.\n\n#### Get a TV Episode\n\n```php\n$item      = new Item($tmdb);\n$tvepisode = $item-\u003egetTVEpisode($tvshow_id, $season_number, $episode_number);\n\necho $tvepisode-\u003egetName();\n```\n\nThe getter returns a [`TVEpisode`](/public/docs/tmdb/class-VfacTmdb.Items.TVEpisode.html) object.\n\n### Collection\u003ca name=\"collection\"\u003e\u003c/a\u003e\n\n#### Search a Collection\n\n```php\n$search    = new Search($tmdb);\n$responses = $search-\u003ecollection('alien');\n```\n\nThe search returns [`Generator`](http://php.net/manual/en/class.generator.php) object of [`Result\\Collection`](/public/docs/tmdb/class-VfacTmdb.Results.Collection.html) object.\n\n[See demo](https://vfac.fr/projects/tmdb/demo/search-collection)\n\n#### Get a Collection\n\n```php\n$item       = new Item($tmdb);\n$collection = $item-\u003egetCollection($collection_id);\n\necho $collection-\u003egetName();\n```\n\nThe getter returns a [`Collection`](/public/docs/tmdb/class-VfacTmdb.Items.Collection.html) object.\n\n[See demo](https://vfac.fr/projects/tmdb/demo/get-collection-details)\n\n### People\u003ca name=\"people\"\u003e\u003c/a\u003e\n\n#### Search a People\n\n```php\n$search    = new Search($tmdb);\n$responses = $search-\u003epeople('alec baldwin');\n```\n\nThe search returns [`Generator`](http://php.net/manual/en/class.generator.php) object of [`Result\\People`](/public/docs/tmdb/class-VfacTmdb.Results.People.html) object.\n\n[See demo](https://vfac.fr/projects/tmdb/demo/search-people)\n\n#### Get a People\n\n```php\n$item   = new Item($tmdb);\n$people = $item-\u003egetPeople($people_id);\n\necho $people-\u003egetName();\n```\n\nThe getter returns a [`People`](/public/docs/tmdb/class-VfacTmdb.Items.People.html) object.\n\n[See demo](https://vfac.fr/projects/tmdb/demo/get-people-details)\n\n### Company\u003ca name=\"company\"\u003e\u003c/a\u003e\n\n#### Search a company\n\n```php\n$search    = new Search($tmdb);\n$responses = $search-\u003ecompany('lucasfilms');\n```\n\nThe search returns [`Generator`](http://php.net/manual/en/class.generator.php) object of `Result\\Company` object.\n\n[See demo](https://vfac.fr/projects/tmdb/demo/search-company)\n\n#### Get a Company\n\n```php\n$item   = new Item($tmdb);\n$company = $item-\u003egetCompany($company_id);\n\necho $company-\u003egetName();\n```\n\nThe getter returns a [`Company`](/public/docs/tmdb/class-VfacTmdb.Results.Company.html) object.\n\n[See demo](https://vfac.fr/projects/tmdb/demo/get-company-details)\n\n### Find by an external ID\u003ca name=\"find\"\u003e\u003c/a\u003e\n\n```php\n$find = new Find($tmdb);\n$responses = $find-\u003eimdb('tt0076759');\n```\n\nThe find method makes it easy to search for objects in TMDb database by an external id.\n\nEach sources has his proper methods: `imdb`, `tvdb`, `tvrage`, `facebook`, `twitter`, `instagram`.\n\nThe find returns a `Result\\Find` object. Each types of objects can be getted by a specific method. The returns is a [`Generator`](http://php.net/manual/en/class.generator.php) object of `Result\\[expected type]` object.\n\n```php\n$movies = $responses-\u003egetMovies();\n$title  = $movies-\u003ecurrent()-\u003egetTitle();\n```\n\n| Object types | Methods | Generator of |\n|--------------|---------|--------------|\n| movies | getMovies() | Result\\Movie |\n| peoples | getPeoples() | Result\\People |\n| TV shows | getTVShows() | Result\\TVShow |\n| TV episodes | getTVEpisodes() | Result\\TVEpisode |\n| TV Seasons | getTVSeasons() | Result\\TVSeason |\n\nThe supported external sources for each object are as follows.\n\n| | Movies | TV Shows | TV Seasons | TV Episodes | People |\n|-|--------|----------|------------|-------------|--------|\n| IMDb ID | \u0026#10003; |\u0026#10003; |\u0026#10005; | \u0026#10003; | \u0026#10003; |\n| TVDb ID | | \u0026#10003; | \u0026#10003; | \u0026#10003; |\u0026#10005; |\n| Freebase MID | not implemented | | | | |\n| Freebase ID  | not implemented | | | | |\n| TVRage |\u0026#10005; | \u0026#10003; | \u0026#10003; | \u0026#10003; | \u0026#10003; |\n| Facebook | \u0026#10003; | \u0026#10003;  |\u0026#10005; |\u0026#10005; | \u0026#10003; |\n| Twitter | \u0026#10003; | \u0026#10003; |\u0026#10005; |\u0026#10005; | \u0026#10003; |\n| Instagram | \u0026#10003; |\u0026#10003; |\u0026#10005; |\u0026#10005; |\u0026#10003; |\n\n### Authentication\u003ca name=\"authentication\"\u003e\u003c/a\u003e\n\nThe connection to your account is in 3 steps:\n\n- Getting a request token\n- Connection to TMDb website\n- Create a session\n\n#### Getting a request token\n\n```php\n$tmdb = Factory::create()-\u003egetTmdb('your_api_key');\n\n$Auth = new Auth($tmdb);\necho $Auth-\u003egetRequestToken();\n```\n\n#### Connect to TMDb website\n\n```php\n$tmdb = Factory::create()-\u003egetTmdb('your_api_key');\n\n$Auth = new Auth($tmdb);\n$Auth-\u003econnect($_POST['request_token']);\n```\n\nThis call redirect the page to TMDb website login page for identification and authorisations. By default, after the connection, the user stay on TMDb website. To redirect to your website after the connection, use the following code:\n\n```php\n$tmdb = Factory::create()-\u003egetTmdb('your_api_key');\n\n$Auth = new Auth($tmdb);\n$Auth-\u003econnect($_POST['request_token'], 'http://your_url');\n```\n\n#### Create a session\n\nTo use all account methods, we must use a valid session.\n\n```php\n$tmdb = Factory::create()-\u003egetTmdb('62dfe9839b8937e595e325a4144702ad');\n\n$Auth = new Auth($tmdb);\necho $Auth-\u003ecreateSession($_POST['request_token']);\n```\n\n### Media Helper\u003ca name=\"media-helper\"\u003e\u003c/a\u003e\n\nAll media informations delivered by the library are relative pathfile.\n\nTo get a valid media URL, use the `Media` class to generate the URL and check the media size\n\n```php\n$media = new Media($tmdb);\n$url = $media-\u003egetPosterUrl('/AbJBXaVPrdXROwb8KmgWUPU2XJX.jpg');\n```\n\nThe following type of media are supported :\n- Backdrop\n- Poster\n- Logo\n- Profile\n- Still\n\n## Unit Testing\u003ca name=\"unit-tests\"\u003e\u003c/a\u003e\n\nYou can run the unit test suites using the following command in the library's source directory:\n\n```\n$ make test\n```\n\n## About\u003ca name=\"about\"\u003e\u003c/a\u003e\n\n### Submitting bugs and feature requests\n\nBugs and feature request are tracked on [GitHub](https://github.com/vfalies/tmdb/issues)\n\n### Author\n\nVincent Faliès - \u003cvincent@vfac.fr\u003e\n\n### License\n\nVfacTmdb is licensed under the MIT License - see the `LICENSE` file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfalies%2Ftmdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvfalies%2Ftmdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfalies%2Ftmdb/lists"}