PHPackages                             glamorous/tmdb-php-api - 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. glamorous/tmdb-php-api

Abandoned → [php-tmdb/api](/?search=php-tmdb%2Fapi)ArchivedLibrary[API Development](/categories/api)

glamorous/tmdb-php-api
======================

PHP Class for using TMDb (themoviedb.org) API. Because of IMDB hasn't an API we provide this PHP5 class. It's pretty easy to recieve all information about a movie or an actor. No scraping needed.

14012648[1 PRs](https://github.com/glamorous/TMDb-PHP-API/pulls)PHP

Since Jun 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/glamorous/TMDb-PHP-API)[ Packagist](https://packagist.org/packages/glamorous/tmdb-php-api)[ RSS](/packages/glamorous-tmdb-php-api/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

TMDb PHP API
============

[](#tmdb-php-api)

**!! IMPORTANT !! This class is not maintained anymore, because of the lack of time and better alternatives that fully support the TMDb API.**

**Good alternatives:**

- **[wtfzdotnet](https://github.com/wtfzdotnet/php-tmdb-api) and offers also a [Symfony2 bundle](https://github.com/wtfzdotnet/WtfzTmdbBundle)**
- **[kriboogh](https://github.com/kriboogh/TMDB4PHP)**
- **[Or other wrappers (and maybe in other languages)](http://www.themoviedb.org/documentation/api/wrappers-libraries)**

---

Why this class
--------------

[](#why-this-class)

This class has been started with the old API version (2.1) because of the lack of a general and recent php class for TMDb at the time. The second reason why this class is made is very simple: I love the work they do at [TMDb](http://themoviedb.org). They provide a great API so everyone can use their database to make cool applications. Now there's a new API v3 and it's supported too. The old version you can find on a [different branch at github](https://github.com/glamorous/TMDb-PHP-API/tree/apiv2).

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

[](#requirements)

- PHP 5.2.x or higher
- cURL
- TMDb API-key

Available methods
-----------------

[](#available-methods)

All methods are listed here, for use, look into the code, everything is documentated. Optional parameters are between brackets \[\]. Also look into the TMDb-documentation for better unstanding of the possible methods.

### Collection

[](#collection)

- getCollection($id, \[$lang\])

### Company

[](#company)

- searchCompany($query, \[$page\])
- getMoviesByCompany($id, \[$page\], \[$lang\])

### Genres

[](#genres)

- getGenres(\[$lang\])
- getMoviesByGenre($id, \[$page\], \[$lang\])

### Movies

[](#movies)

- searchMovie($query, \[$page\], \[$adult\], \[$lang\])
- getMovie($id, \[$lang\])
- getMovieCast($id)
- getMovieImages($id, \[$lang\])
- getMovieKeywords($id)
- getMovieReleases($id)
- getMovieTitles($id, \[$country\])
- getMovieTrailers($id, \[$lang\])
- getMovieTranslations($id)
- getMoviesByCompany($id, \[$page\], \[$lang\])
- getMoviesByGenre($id, \[$page\], \[$lang\])
- getLatestMovie()
- getTopRatedMovies(\[$page\], \[$lang\])
- getPopularMovies(\[$page\], \[$lang\])
- getUpcomingMovies(\[$page\], \[$lang\])
- getNowPlayingMovies(\[$page\], \[$lang\])
- getSimularMovies($id, \[$page\], \[$lang\])
- getChangedMovies(\[$page\], \[$start\_date\], \[$end\_date\])
- getMovieChanges($id)

### Persons

[](#persons)

- searchPerson($query, \[$page\], \[$adult\])
- getPerson($id)
- getPersonCredits($id, \[$lang\])
- getPersonImages($id)
- getChangedPersons(\[$page\], \[$start\_date\], \[$end\_date\])
- getPersonChanges($id)

### Authentication

[](#authentication)

- getAuthToken()
- getAuthSession($token)
- setAuthSession($id)

### Account

[](#account)

- addFavoriteMovie($account\_id, $session\_id, $movie\_id, TRUE)
- addMovieRating($session\_id, $movie\_id, $value)
- addMovieToWatchlist($account\_id, $session\_id, $movie\_id)
- getAccount($session\_id)
- getAccountFavoriteMovies($account\_id, $session\_id, \[$page\], \[$lang\])
- getAccountRatedMovies($account\_id, $session\_id, \[$page\], \[$lang\])
- getAccountWatchlistMovies($account\_id, $session\_id, \[$page\], \[$lang\])

### Misc

[](#misc)

- getAvailableImageSizes($imagetype)
- getConfig()
- getConfiguration()
- getImageUrl($filepath, $imagetype, $size)
- getLang()
- setLang($languague)
- getVersion($uri)

How to use
----------

[](#how-to-use)

### Initialize the class

[](#initialize-the-class)

```

```

### Authentication

[](#authentication-1)

It's important to read the TMDb-documentation about this one. The necessary methods are available to retrieve a valid token and session\_id (more information on the [TMDb Knowledge Base](http://help.themoviedb.org/kb/api/user-authentication))

```

```

Then you have to redirect the user to TMDb-website with the `Authentication-Callback` find in the `$token`-variable received from the method `getAuthToken` so the user can autorise your app.

```

```

Store the session\_id securely for that particular user and use it for authenticated calls.

IF you have saved the session\_id, you can use it (optional) set it with every authenticated request for every user or you can set it globally with the method `setAuthSession`.

### Configuration

[](#configuration)

The configuration is something new in API v3. It's used to retrieve information from TMDb so you only have to request it once. It's your task to save it (or cache) and sometimes retrieve a new version.

```

```

### Images

[](#images)

The way to retrieve images is a little bit different then before. You retrieve filepaths in you request. To parse an url you need to use the configuration and some extra methods.

```

```

There are now 3 formats available for the images: `TMDb::IMAGE_BACKDROP`, `TMDb::IMAGE_POSTER`, `TMDb::IMAGE_PROFILE`. To retrieve all available image size for a particular imagetype you can use the method `getAvailableImageSizes`.

```

```

### Versions

[](#versions)

With the new version of the API (v3) there aren't specific methods to track the state of a movie or a person. Like [TMDb suggested](http://help.themoviedb.org/kb/api/content-versioning) you can now use the header information, especially the ETag to check the state of the content of a specific method.

```

```

### HTTPS / SSL

[](#https--ssl)

With the new version of the API (v3) there's support for SSL. This class supports working with `https` too.

```

```

Issues/Bugs
-----------

[](#issuesbugs)

It's always possible to find some issues. If you find one, please inform us with the issue tracker on [github](http://github.com/glamorous/TMDb-PHP-API/issues). Please don't use this to ask question how to use this class. It's straight forward and easy to understand for everyone with a basic knowledge of PHP.

Changelog
---------

[](#changelog)

**TMDb 1.5.1 - 16/11/2012**

- \[bug\] getPersonCredits wasn't working the correct way. Thanks to the github user [caa007](https://github.com/caa007). Closed issue [\#11](https://github.com/glamorous/TMDb-PHP-API/issues/11).

**TMDb 1.5.0 - 16/11/2012**

- \[feature\] Support for SSL

**TMDb 1.4.0 - 11/10/2012**

- \[feature\] New method for retrieving a movie changes: `getMovieChanges`
- \[feature\] New method for retrieving all changed movies: `getChangedMovies`
- \[feature\] New method for retrieving a person changes: `getPersonChanges`
- \[feature\] New method for retrieving all changed persons: `getChangedPersons`

**TMDb 1.3.0 - 22/08/2012**

- \[feature\] Get ETag from a method to keep track of state of content, for more information go to [TMDb kb-article](http://help.themoviedb.org/kb/api/content-versioning)

**TMDb 1.2.0 - 21/08/2012**

- \[bug\]\[feature\] It wasn't possible to use some methods without a language parameter. Now you can pass `FALSE` to it to retrieve all the results without thinking about any language.

**TMDb 1.1.1 - 20/08/2012**

- \[bug\] Deleted some debugging content

**TMDb 1.1.0 - 12/08/2012**

- \[feature\] New method for retrieving movie trailers: `getMovieTrailers` It was being forgotten in the first release for the new API (Closed issue #10)

**TMDb 1.0.2 - 07/08/2012**

- \[bug\] On some recent servers the `&` were replaced with `&amp;` so a `POST` to an old Tomcat java server wouldn't be properly handled. (Closed issue #9)

**TMDb 1.0.1 - 01/08/2012**

- \[improvement\] `addMovieRating` works better now, whatever you pass trough, it's been casted to `0` or a decent float.

**TMDb 1.0.0 - 30/07/2012**

- The class works now only with API v3.
- All available methods from API v3 are supported by the API
- Old changelog (API v2) is available at [github](https://github.com/glamorous/TMDb-PHP-API/tree/apiv2)

Handle Errors
-------------

[](#handle-errors)

This class throws an TMDbException when an error is in the class is made by the CURL request or if there's a problem with the TMDb-API).

License
-------

[](#license)

This plugin has a [BSD License](http://www.opensource.org/licenses/bsd-license.php). You can find the license in license.txt that is included with class-package

[![githalytics.com alpha](https://camo.githubusercontent.com/974bedfb752dd53fda14679a6945c9c448d7fb6bcfcc3cbf7ea9849353d3d237/68747470733a2f2f637275656c2d6361726c6f74612e7061676f6461626f782e636f6d2f6638313166636634363337353639353931306136643539383764313561353566)](https://camo.githubusercontent.com/974bedfb752dd53fda14679a6945c9c448d7fb6bcfcc3cbf7ea9849353d3d237/68747470733a2f2f637275656c2d6361726c6f74612e7061676f6461626f782e636f6d2f6638313166636634363337353639353931306136643539383764313561353566)

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.7% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/62723?v=4)[Jonas De Smet](/maintainers/glamorous)[@glamorous](https://github.com/glamorous)

---

Top Contributors

[![glamorous](https://avatars.githubusercontent.com/u/62723?v=4)](https://github.com/glamorous "glamorous (45 commits)")[![turanct](https://avatars.githubusercontent.com/u/1728360?v=4)](https://github.com/turanct "turanct (1 commits)")[![wtfzdotnet](https://avatars.githubusercontent.com/u/639376?v=4)](https://github.com/wtfzdotnet "wtfzdotnet (1 commits)")

### Embed Badge

![Health badge](/badges/glamorous-tmdb-php-api/health.svg)

```
[![Health](https://phpackages.com/badges/glamorous-tmdb-php-api/health.svg)](https://phpackages.com/packages/glamorous-tmdb-php-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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