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

ActiveLibrary[API Development](/categories/api)

wtfzdotnet/php-tmdb-api
=======================

PHP wrapper for TMDB (TheMovieDatabase) API v3. Supports two types of approaches, one modelled with repositories, models and factories. And the other by simple array access to RAW data from The Movie Database.

4.1.3(3y ago)4242.9k119[2 PRs](https://github.com/php-tmdb/api/pulls)MITPHPPHP ^7.3 || ^7.4 || ^8.0 || ^8.1CI passing

Since Feb 27Pushed 3mo ago27 watchersCompare

[ Source](https://github.com/php-tmdb/api)[ Packagist](https://packagist.org/packages/wtfzdotnet/php-tmdb-api)[ Docs](https://github.com/php-tmdb/api)[ Fund](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SMLZ362KQ8K8W)[ GitHub Sponsors](https://github.com/php-tmdb)[ RSS](/packages/wtfzdotnet-php-tmdb-api/feed)WikiDiscussions 4.1 Synced 1mo ago

READMEChangelog (10)Dependencies (25)Versions (78)Used By (0)

A PHP Wrapper for use with the [TMDB API](https://developers.themoviedb.org/4/).
================================================================================

[](#a-php-wrapper-for-use-with-the-tmdb-api)

[![License](https://camo.githubusercontent.com/28f52d047cb88ab284bc3d906d2ef8618c5ad85995adf51bd969e797de8af196/68747470733a2f2f706f7365722e707567782e6f72672f7068702d746d64622f6170692f6c6963656e73652e706e67)](https://packagist.org/packages/php-tmdb/api)[![License](https://camo.githubusercontent.com/57abdbdac74150da64724d0207b1da2a018854040ceee92ef31c68db16208d6b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f7068702d746d64622f617069)](https://github.com/php-tmdb/api/releases)[![Build Status](https://camo.githubusercontent.com/b83908693761f06ac3a9b4ebd607d00e7bc0b4c766886df5281e3fdc862accc3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7068702d746d64622f6170692f636f6e74696e756f75732d696e746567726174696f6e2e796d6c3f6c6162656c3d706870756e6974)](https://github.com/php-tmdb/api/actions/workflows/continuous-integration.yml)[![Build Status](https://camo.githubusercontent.com/3528d83d437bc8c9f3f207d7d29dcb07bfb42ec200809aa574a4ce719d9b6868/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7068702d746d64622f6170692f636f64696e672d7374616e64617264732e796d6c3f6c6162656c3d7068706373)](https://github.com/php-tmdb/api/actions/workflows/coding-standards.yml)[![codecov](https://camo.githubusercontent.com/5603bf07f342ce6e3fff15b3a2c5d36662fab188b1f378be8e7d6ea93698d30b/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f7068702d746d64622f6170693f746f6b656e3d67544d3941694f357648)](https://codecov.io/gh/php-tmdb/api)[![PHP](https://camo.githubusercontent.com/e270af1d0de5a2a320ffb768ca9138c16801e44ab6d8f25a4e21e38feea456c8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e332c2532302533453d372e342c2532302533453d382e302d3838393242462e737667)](https://packagist.org/packages/php-tmdb/api)[![Total Downloads](https://camo.githubusercontent.com/a1eb9ea81b8b2a966147fb02351d51795d70e6b469c7df72eedb8f08c34ba1da/68747470733a2f2f706f7365722e707567782e6f72672f7068702d746d64622f6170692f646f776e6c6f6164732e737667)](https://packagist.org/packages/php-tmdb/api)

Tests run with minimal, normal and development dependencies.

Buy me a coffee, or a beer :-)
------------------------------

[](#buy-me-a-coffee-or-a-beer--)

[![](https://camo.githubusercontent.com/e1ff554a09e8e92bef25abc553ff05b88f45afd695877cf12f3a46558ef65b2e/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f55532f692f62746e2f62746e5f646f6e61746543435f4c472e676966)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=SMLZ362KQ8K8W)

My stomach will appreciate your donation!

Main features
-------------

[](#main-features)

- Array implementation of the movie database (RAW)
- Model implementation of the movie database (By making use of the repositories)
- An `ImageHelper` class to help build image urls or html ![]() elements.

Attention newcomers to php
--------------------------

[](#attention-newcomers-to-php)

*If you are new to php and starting a project to learn, I'd recommend [you skip down to the installation](#install-php-tmdbapi), and then follow [the quickstart](#new-to-psr-standards-or-composer) that's just for you!*

I do advise you to take a broader look later on what all these PSR standards mean and do for the php community :-).

PSR Compliance
--------------

[](#psr-compliance)

We try to leave as many options open to the end users of this library, as such with 4.0 changes have been made to introduce PSR compliance where we can. You bring the dependencies you prefer that are compliant with PSR standards, register the listeners, and we handle the rest.

- [PSR-3: Logger Interface](https://www.php-fig.org/psr/psr-3/), [jump to section](#logging).
    - Logs TMDB API exceptions, [jump to section](#tmdbeventlistenerloggerlogapierrorlistener).
    - Logs PSR-18 client exceptions, [jump to section](#tmdbeventlistenerloggerloghttpmessagelistener).
    - Logs requests and responses, [jump to section](#tmdbeventlistenerloggerloghttpmessagelistener).
    - Logs response hydration, [jump to section](#tmdbeventlistenerloggerloghydrationlistener).
    - Logs caching behavior , [jump to section](#todo).
- [PSR-6: Caching Interface](https://www.php-fig.org/psr/psr-6/), [jump to section](#caching).
- [PSR-7: HTTP Message Interface](https://www.php-fig.org/psr/psr-7/)
    - Requests and responses will be modified via relevant event listeners.
- *[PSR-12: Extended Coding Style](https://www.php-fig.org/psr/psr-12/).*
    - Work in progress, I'll do my best to finish before `4.1` but there is a lot to review and refactor. It would be nice to get contributions going our way helping out with this massive task. I can imagine it may take several months of doing small bits here and there to achieve this.
- [PSR-14: Event Dispatcher](https://www.php-fig.org/psr/psr-7/), [jump to section](#event-dispatching).
    - Register our listeners and events, we handle the rest.
- *[PSR-16: Simple Cache](https://www.php-fig.org/psr/psr-16/), by adapting to PSR-6*
    - Although we do not implement this at the current stage, there are plenty of adapters converting `PSR-16` implementations to `PSR-6`.
    - We might rework this at a later stage to prevent the extra dependencies that the `php-http/cache-plugin` brings along.
- [PSR-17: HTTP Factories](https://www.php-fig.org/psr/psr-17/)
    - Bring along the http factories of your choice.
- [PSR-18: HTTP Client](https://www.php-fig.org/psr/psr-18/)
    - Bring along the PSR-18 http client of your choice.

Framework implementations
-------------------------

[](#framework-implementations)

- Symfony *(maintained by php-tmdb developers)*
    - [php-tmdb/symfony](https://github.com/php-tmdb/symfony)
- Laravel *(community maintained)*
    - [php-tmdb/laravel](https://github.com/php-tmdb/laravel)

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

[](#installation)

Install [composer](https://getcomposer.org/download/).

Before we can install the api library, you need to install a set of dependencies that provide the following implementations.

Dependencies you have to fulfill yourself
-----------------------------------------

[](#dependencies-you-have-to-fulfill-yourself)

- For `PSR-7: HTTP Message Interface`, for example `nyholm/psr7`.
- For `PSR-14: Event Dispatcher`, for example `symfony/event-dispatcher`.
- For `PSR-17: HTTP Factories`, for example `nyholm/psr7`.
- For `PSR-18: HTTP Client`, for example `guzzlehttp/guzzle`.

**I urge you to implement the optional caching implementation**

When making use of caching, make sure to also include `php-http/cache-plugin` in composer, this plugin handles the logic for us, so we don't have to re-invent the wheel. You are however also free to choose to implement your own cache listener, or add the caching logic inside the http client of your choice.

```
composer require php-http/cache-plugin:^1.7
```

Even though [themoviedb.org](https://www.themoviedb.org/) disabled [rate limiting](https://developers.themoviedb.org/3/getting-started/request-rate-limiting) since the end of 2019, I'd still recommend enabling the cache to make your application run a bit smoother. As such the `427` retry subscriber in previous versions is not present anymore.

- For `PSR-6: Caching Interface`, for example `symfony/cache`.
- For `PSR-16: Simple Cache`, with an PSR-6 adapter for example `symfony/cache`, then use [the PSR-16 to PSR-6 adapter](https://symfony.com/doc/current/components/cache/psr6_psr16_adapters.html).

Not only will this make your application more responsive, by loading from cache when we can, it also decreases the amount of requests we need to send.

*Optional dependencies*

- For `PSR-3: Logger Interface`, for example `monolog/monolog`.

Install php-tmdb/api
--------------------

[](#install-php-tmdbapi)

If the required dependencies above are met, you are ready to install the library.

```
composer require php-tmdb/api:^4
```

Include Composer's autoloader:

```
require_once dirname(__DIR__).'/vendor/autoload.php';
```

To use the examples provided, copy the `examples/apikey.php.dist` to `examples/apikey.php` and change the settings.

### New to PSR standards or composer?

[](#new-to-psr-standards-or-composer)

If you came here looking to start a fun project to start learning, the above might seem a little daunting.

Don't worry! The documentation here was setup with beginners in mind as well.

We also provide a bunch of examples in the `examples/` folder.

To get started;

```
composer require php-tmdb/api:^4 symfony/event-dispatcher guzzlehttp/guzzle symfony/cache monolog/monolog nyholm/psr7
```

Now that we have everything we need installed, let's get started setting up to be able to use the library.

Quick setup
-----------

[](#quick-setup)

Review the setup files below and go over the [examples](examples/) folder, for example [examples/movies/api/get.php](examples/movies/model/get.php) or [examples/movies/api/get.php](examples/movies/api/get.php) files.

Constructing the Client
-----------------------

[](#constructing-the-client)

*If you have chosen different implementations than the examples suggested beforehand, obviously all the upcoming documentation won't match. Adjust accordingly to your dependencies, we will go along with the examples given earlier.*

- [Minimal setup](examples/setup-client.php)
- [Minimal setup with psr-6 caching](examples/setup-client-cache-psr6.php)
- [Full setup](examples/setup-client-full.php)
    - Includes logging
    - Includes caching
    - Includes filtering by region
    - Includes filtering by language
    - Includes filtering by adult content

General API Usage
-----------------

[](#general-api-usage)

If you're looking for a simple array entry point the API namespace is the place to be, however we recommend you use the [repositories and model](#model-usage)'s functionality up ahead.

```
use Tmdb\Client;

$client = new Client();
$movie = $client->getMoviesApi()->getMovie(550);
```

If you want to provide any other query arguments.

```
use Tmdb\Client;

$client = new Client();
$movie = $client->getMoviesApi()->getMovie(550, ['language' => 'en']);
```

For all further calls just review the [unit tests](test/Tmdb/Tests) or [examples](examples/) provided, or the API classes themselves.

Model Usage
-----------

[](#model-usage)

The library can also be used in an object oriented manner, which I reckon is the **preferred** way of doing things.

Instead of calling upon the client, you pass the client onto one of the many repositories and do then some work on it.

```
use Tmdb\Repository\MovieRepository;
use Tmdb\Client;

$client = new Client();
$repository = new MovieRepository($client);
$movie = $repository->load(87421);

echo $movie->getTitle();
```

**The repositories also contain the other API methods that are available through the API namespace.**

```
use Tmdb\Repository\MovieRepository;
use Tmdb\Client;

$client = new Client();
$repository = new MovieRepository($client);
$topRated = $repository->getTopRated(['page' => 3]);
// or
$popular = $repository->getPopular();
```

For all further calls just review the [unit tests](test/Tmdb/Tests) or [examples](examples/) provided, or the model's themselves.

Event Dispatching
-----------------

[](#event-dispatching)

We (can) dispatch the following events inside the library, which by using event listeners you could modify some behavior.

### HTTP Client exceptions

[](#http-client-exceptions)

- `Tmdb\Event\HttpClientExceptionEvent`
    - Allows to still set a successful response if the error can be corrected, by calling `$event->isPropagated()` in your listener, this does require you to provide a PSR-7 response object and set it with `$event->setResponse($response)`.

### TMDB API exceptions

[](#tmdb-api-exceptions)

- `Tmdb\Event\TmdbExceptionEvent`
    - Allows to still set a successful response if the error can be corrected, by calling `$event->isPropagated()` in your listener, this does require you to provide a PSR-7 response object and set it with `$event->setResponse($response)`.

### Hydration

[](#hydration)

- `Tmdb\Event\BeforeHydrationEvent`, *allows modification of the response data before being hydrated.*
    - This event will still be thrown regardless if the `event_listener_handles_hydration` option is set to false, this allows for example the logger to still produce records.
- `Tmdb\Event\AfterHydrationEvent`, *allows modification of the eventual subject returned.*

The current implementation within the event dispatcher causes significant overhead, you might actually not want at all.

*In the future we will look into this further for improvement, for now we have bigger fish to catch.*

From `4.0` moving forward by default the hydration events have been disabled.

To re-enable this functionality, we recommend only using it for models you need to modify data for;

```
use Tmdb\Client;

$client = new Client([
    'hydration' => [
        'event_listener_handles_hydration' => true,
        'only_for_specified_models' => [
            Tmdb\Model\Movie::class
        ]
    ]
]);
```

If that configuration has been applied, also make sure the event dispatcher you use is aware of our `HydrationListener`;

```
use Symfony\Component\EventDispatcher\EventDispatcher;
use Tmdb\Event\HydrationEvent;
use Tmdb\Event\Listener\HydrationListener;

$eventDispatcher = new EventDispatcher();
$hydrationListener = new HydrationListener($eventDispatcher);
$eventDispatcher->addListener(HydrationEvent::class, $hydrationListener);
```

*If you re-enable this functionality without specifying any models, all hydration will be done through the event listeners.*

### Requests &amp; Responses

[](#requests--responses)

- `Tmdb\Event\BeforeRequestEvent`
    - Allows modification of the PSR-7 request data before being sent.
    - Allows early response behavior ( think of caching ), by calling `$event->isPropagated()` in your listener, this does require you to provide a PSR-7 response object and set it with `$event->setResponse($response)`
- `Tmdb\Event\ResponseEvent`
    - Contains the `Request` object.
    - Allows modification of the PSR-7 response before being hydrated, this does require you to provide a PSR-7 response object and set it with `$event->setResponse($response)`
    - Allows end-user to implement their own cache, or any other actions you'd like to perform on the given response.

Event listeners
---------------

[](#event-listeners)

We have a couple of optional event listeners that you could add to provide additional functionality.

### Caching

[](#caching)

Instead of constructing the default `RequestListener`, construct the client with the `Psr6CachedRequestListener`.

```
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Tmdb\Event\Listener\Psr6CachedRequestListener;
use Tmdb\Repository\MovieRepository;
use Tmdb\Client;

$client = new Client();

$cache = new FilesystemAdapter('php-tmdb', 86400, __DIR__ . '/cache');
$requestListener = new Psr6CachedRequestListener(
    $client->getHttpClient(),
    $client->getEventDispatcher(),
    $cache,
    $client->getHttpClient()->getPsr17StreamFactory(),
    []
);

$repository = new MovieRepository($client);
$popular = $repository->getPopular();
```

*The current implementation will change again in the future, it will either involve a small change in listener registration, or will just happen without you being aware.* We currently base this on `php-http/cache-plugin`, which pulls in extra dependencies we don't really use. Since caching is quite a subject itself, for now we have chosen the "quick 'n dirty way".

### Logging

[](#logging)

The logging is divided in a couple of listeners, so you can decide what you want to log, or not. All of these listeners have support for writing custom formatted messages. See the relevant interfaces and classes located in the `Tmdb\Formatter` namespace.

Instead of monolog you can pass any PSR-3 compatible logger.

#### Tmdb\\Event\\Listener\\Logger\\LogApiErrorListener

[](#tmdbeventlistenerloggerlogapierrorlistener)

```
use Monolog\Logger;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Tmdb\Event\Listener\Logger\LogApiErrorListener;
use Tmdb\Event\TmdbExceptionEvent;
use Tmdb\Formatter\TmdbApiException\SimpleTmdbApiExceptionFormatter;

$eventDispatcher = new EventDispatcher();
$apiErrorListener = new LogApiErrorListener(
    new Logger(),
    new SimpleTmdbApiExceptionFormatter()
);

$eventDispatcher->addListener(TmdbExceptionEvent::class, $apiErrorListener);
```

This will log exceptions thrown when a response has successfully been received, but the response indicated the request was not successful.

```
[2021-01-01 13:24:14] php-tmdb.CRITICAL: Critical API exception: 7 Invalid API key: You must be granted a valid key. [] []

```

#### Tmdb\\Event\\Listener\\Logger\\LogHttpMessageListener

[](#tmdbeventlistenerloggerloghttpmessagelistener)

```
use Symfony\Component\EventDispatcher\EventDispatcher;
use Tmdb\Event\BeforeRequestEvent;
use Tmdb\Event\HttpClientExceptionEvent;
use Tmdb\Event\Listener\Logger\LogHttpMessageListener;
use Tmdb\Event\ResponseEvent;
use Tmdb\Formatter\HttpMessage\SimpleHttpMessageFormatter;

$eventDispatcher = new EventDispatcher();
$requestLoggerListener = new LogHttpMessageListener(
    new Monolog\Logger(),
    new SimpleHttpMessageFormatter()
);

$eventDispatcher->addListener(BeforeRequestEvent::class, $requestLoggerListener);
$eventDispatcher->addListener(ResponseEvent::class, $requestLoggerListener);
$eventDispatcher->addListener(HttpClientExceptionEvent::class, $requestLoggerListener);
```

This will log outgoing requests and responses.

```
[2021-01-01 13:11:18] php-tmdb.INFO: Sending request: GET https://api.themoviedb.org/3/company/1?include_adult=true&language=en-US&region=us 1.1 {"length":0,"has_session_token":false} []
[2021-01-01 13:11:18] php-tmdb.INFO: Received response: 200 OK 1.1 {"status_code":200,"length":223} []

```

In case of any other PSR-18 client exceptions ( connection errors for example ), these will also be written to the log.

```
[2021-01-01 13:36:39] php-tmdb.INFO: Sending request: GET https://api.themoviedb.org/3/company/1?include_adult=true&language=en-US&region=us 1.1 {"length":0,"has_session_token":false} []
[2021-01-01 13:36:39] php-tmdb.CRITICAL: Critical http client error: 0 cURL error 7: Failed to connect to api.themoviedb.org port 443: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) {"request":"https://api.themoviedb.org/3/company/1?include_adult=true&language=en-US&region=us"} []

```

#### Tmdb\\Event\\Listener\\Logger\\LogHydrationListener

[](#tmdbeventlistenerloggerloghydrationlistener)

```
use Symfony\Component\EventDispatcher\EventDispatcher;
use Tmdb\Event\BeforeHydrationEvent;
use Tmdb\Event\Listener\Logger\LogHydrationListener;
use Tmdb\Formatter\Hydration\SimpleHydrationFormatter;

$eventDispatcher = new EventDispatcher();
$hydrationLoggerListener = new LogHydrationListener(
    new Monolog\Logger(),
    new SimpleHydrationFormatter(),
    false // set to true if you wish to add the json data passed for each hydration, do not use this in production!
);

$eventDispatcher->addListener(BeforeHydrationEvent::class, $hydrationLoggerListener);
```

This will log hydration of models with (optionally) their data, useful for debugging.

```
[2021-01-01 13:11:18] php-tmdb.DEBUG: Hydrating model "Tmdb\Model\Image\LogoImage". {"data":{"file_path":"/o86DbpburjxrqAzEDhXZcyE8pDb.png"},"data_size":49} []
[2021-01-01 13:11:18] php-tmdb.DEBUG: Hydrating model "Tmdb\Model\Company". {"data":{"description":"","headquarters":"San Francisco, California","homepage":"https://www.lucasfilm.com/","id":1,"logo_path":"/o86DbpburjxrqAzEDhXZcyE8pDb.png","name":"Lucasfilm Ltd.","origin_country":"US","parent_company":null},"data_size":227} []

```

For calls with a lot of appended data, this quickly becomes a large dump in the log file, and I would advise to only use this when necessary.

**Do not enable the hydration data dumping on production, it will generate massive logs**.

### Adult filter

[](#adult-filter)

To enable inclusion of results considered "adult", add the following listener.

```
use Symfony\Component\EventDispatcher\EventDispatcher;
use Tmdb\Event\BeforeRequestEvent;
use Tmdb\Event\Listener\Request\AdultFilterRequestListener;

$eventDispatcher = new EventDispatcher();
$adultFilterListener = new AdultFilterRequestListener(true);

$eventDispatcher->addListener(BeforeRequestEvent::class, $adultFilterListener);
```

### Language filter

[](#language-filter)

To enable filtering contents on language, add the following listener.

```
use Symfony\Component\EventDispatcher\EventDispatcher;
use Tmdb\Event\BeforeRequestEvent;
use Tmdb\Event\Listener\Request\LanguageFilterRequestListener;

$eventDispatcher = new EventDispatcher();
$languageFilterListener = new LanguageFilterRequestListener('nl-NL');

$eventDispatcher->addListener(BeforeRequestEvent::class, $languageFilterListener);
```

### Region filter

[](#region-filter)

To enable filtering contents on region, add the following listener.

```
use Symfony\Component\EventDispatcher\EventDispatcher;
use Tmdb\Event\BeforeRequestEvent;
use Tmdb\Event\Listener\Request\RegionFilterRequestListener;

$eventDispatcher = new EventDispatcher();
$regionFilterListener = new RegionFilterRequestListener('nl');

$eventDispatcher->addListener(BeforeRequestEvent::class, $regionFilterListener);
```

Guest session
-------------

[](#guest-session)

If you want to make use of guest sessions, you need to specify this explicitly on the client.

```
use Tmdb\Client;
use Tmdb\Token\Session\GuestSessionToken;

$client = new Client();
$client->setGuestSessionToken(new GuestSessionToken('my_token'));

// Now you can make calls in the guest sessions namespace.
```

Image Helper
------------

[](#image-helper)

An `ImageHelper` class is present to take care of the images, which does require the configuration to be loaded:

```
use Tmdb\Client;
use Tmdb\Helper\ImageHelper;
use Tmdb\Model\Image;
use Tmdb\Repository\ConfigurationRepository;

$client = new Client();
$image = new Image();
$configRepository = new ConfigurationRepository($client);
$config = $configRepository->load();

$imageHelper = new ImageHelper($config);

echo $imageHelper->getHtml($image, 'w154', 154, 80);
```

Collection Filtering
--------------------

[](#collection-filtering)

We also provide some easy methods to filter any collection, you should note however you can always implement your own filter easily by using Closures:

```
use Tmdb\Model\Movie;
use Tmdb\Model\Image\PosterImage;

$movie = new Movie();

foreach($movie->getImages()->filter(
        function($key, $value){
            return $value instanceof PosterImage;
        }
    ) as $image) {
        // do something with all poster images
}
```

These basic filters however are already covered in the `Images` collection object:

```
use Tmdb\Model\Movie;

/** @var $movie Movie **/
$backdrop = $movie
    ->getImages()
    ->filterBackdrops()
;
```

*And there are more Collections which provide filters, but you will find those out along the way.*

### The GenericCollection and the ResultCollection

[](#the-genericcollection-and-the-resultcollection)

- The `GenericCollection` holds any collection of objects (e.g. an collection of movies).
- The `ResultCollection` is an extension of the `GenericCollection`, and inherits the response parameters *(page, total\_pages, total\_results)* from an result set, this can be used to create pagination.

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance57

Moderate activity, may be stable

Popularity39

Limited adoption so far

Community32

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 78.4% 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 ~59 days

Recently: every ~330 days

Total

74

Last Release

98d ago

Major Versions

v1.4.2 → v2.0.02015-01-25

2.1.17 → 3.0.02020-03-23

3.0.x-dev → 4.0.02021-01-04

PHP version history (7 changes)v1.0.0-ALPHA1PHP &gt;=5.3.2

v2.0.0PHP &gt;=5.4.0

2.1.2PHP &gt;=5.6.0

3.0.0PHP &gt;=7.1.3

4.0.0PHP ^7.3 || ^8.0

4.0.1PHP ^7.3 || ^7.4 || ^8.0

4.1.0PHP ^7.3 || ^7.4 || ^8.0 || ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/639376?v=4)[Michael Roterman](/maintainers/wtfzdotnet)[@wtfzdotnet](https://github.com/wtfzdotnet)

---

Top Contributors

[![wtfzdotnet](https://avatars.githubusercontent.com/u/639376?v=4)](https://github.com/wtfzdotnet "wtfzdotnet (684 commits)")[![neildaniels](https://avatars.githubusercontent.com/u/417182?v=4)](https://github.com/neildaniels "neildaniels (62 commits)")[![yukoff](https://avatars.githubusercontent.com/u/1076681?v=4)](https://github.com/yukoff "yukoff (51 commits)")[![DariusIII](https://avatars.githubusercontent.com/u/3399658?v=4)](https://github.com/DariusIII "DariusIII (9 commits)")[![z38](https://avatars.githubusercontent.com/u/3948085?v=4)](https://github.com/z38 "z38 (8 commits)")[![wagnered](https://avatars.githubusercontent.com/u/6115438?v=4)](https://github.com/wagnered "wagnered (7 commits)")[![ihsudg](https://avatars.githubusercontent.com/u/59794272?v=4)](https://github.com/ihsudg "ihsudg (6 commits)")[![wells](https://avatars.githubusercontent.com/u/2041871?v=4)](https://github.com/wells "wells (5 commits)")[![ptheofan](https://avatars.githubusercontent.com/u/880939?v=4)](https://github.com/ptheofan "ptheofan (4 commits)")[![SosthenG](https://avatars.githubusercontent.com/u/22033159?v=4)](https://github.com/SosthenG "SosthenG (4 commits)")[![mihaeu](https://avatars.githubusercontent.com/u/2168701?v=4)](https://github.com/mihaeu "mihaeu (4 commits)")[![thinkingmedia](https://avatars.githubusercontent.com/u/551022?v=4)](https://github.com/thinkingmedia "thinkingmedia (3 commits)")[![johannesx75](https://avatars.githubusercontent.com/u/3908339?v=4)](https://github.com/johannesx75 "johannesx75 (3 commits)")[![NMullen](https://avatars.githubusercontent.com/u/2364160?v=4)](https://github.com/NMullen "NMullen (3 commits)")[![okaufmann](https://avatars.githubusercontent.com/u/4414498?v=4)](https://github.com/okaufmann "okaufmann (2 commits)")[![JackW6809](https://avatars.githubusercontent.com/u/53652452?v=4)](https://github.com/JackW6809 "JackW6809 (2 commits)")[![MarkRedeman](https://avatars.githubusercontent.com/u/1114829?v=4)](https://github.com/MarkRedeman "MarkRedeman (2 commits)")[![nbraquart](https://avatars.githubusercontent.com/u/18246102?v=4)](https://github.com/nbraquart "nbraquart (2 commits)")[![romanpravda](https://avatars.githubusercontent.com/u/59819062?v=4)](https://github.com/romanpravda "romanpravda (1 commits)")[![sirikkoster](https://avatars.githubusercontent.com/u/1142841?v=4)](https://github.com/sirikkoster "sirikkoster (1 commits)")

---

Tags

moviemovie-databasemoviesphp-tmdbpsr-12psr-17psr-18psr-3psr-6psr-7tmdbtmdb-apitvphpapiwrappermovietv showtvtvdbtmdb

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[php-tmdb/api

PHP wrapper for TMDB (TheMovieDatabase) API v3. Supports two types of approaches, one modelled with repositories, models and factories. And the other by simple array access to RAW data from The Movie Database.

424378.6k16](/packages/php-tmdb-api)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[php-tmdb/laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the wtfzdotnet/php-tmdb-api library.

16553.3k1](/packages/php-tmdb-laravel)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

963.1M35](/packages/getbrevo-brevo-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[php-tmdb/symfony

Symfony Bundle for TMDB (The Movie Database) API. Provides easy access to the php-tmdb/api library.

3649.7k](/packages/php-tmdb-symfony)

PHPackages © 2026

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