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

ActiveLibrary[API Development](/categories/api)

webrussell/php-tmdb
===================

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

v2.0.1(6y ago)02MITPHPPHP &gt;=7.0

Since Sep 13Pushed 6y agoCompare

[ Source](https://github.com/patwebrussell/php-tmdb-laravel-7.x)[ Packagist](https://packagist.org/packages/webrussell/php-tmdb)[ RSS](/packages/webrussell-php-tmdb/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (16)Used By (0)

Laravel Package for TMDB API Wrapper
====================================

[](#laravel-package-for-tmdb-api-wrapper)

[![License](https://camo.githubusercontent.com/e5bb5faf6e5b4e0594b874525adf01487108a86103ba16ff0b61dc56af83232d/68747470733a2f2f706f7365722e707567782e6f72672f7068702d746d64622f6c61726176656c2f6c6963656e73652e706e67)](https://packagist.org/packages/php-tmdb/laravel)[![Build Status](https://camo.githubusercontent.com/113325e0885e6b339e456a7df8a5f7ab2935cbd5462b6bdca0c04b3bb233e531/68747470733a2f2f7472617669732d63692e6f72672f7068702d746d64622f6c61726176656c2e737667)](https://travis-ci.org/php-tmdb/laravel)[![Code Coverage](https://camo.githubusercontent.com/c6ed17f4eccf32e93b738a8a3d17e12d171235330462db64647d09cd780e91fe/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7068702d746d64622f6c61726176656c2f6261646765732f636f7665726167652e706e67)](https://scrutinizer-ci.com/g/php-tmdb/laravel/)[![PHP & HHVM](https://camo.githubusercontent.com/66d97ed9673b06a01c52b304204be3a4818bee1d986ba2d0074ca4c7a2aeb8af/68747470733a2f2f7068702d6579652e636f6d2f62616467652f7068702d746d64622f6c61726176656c2f7465737465642e737667)](https://php-eye.com/package/php-tmdb/laravel)

This package was created originaly by travis but was frozen in time with Laravel 5.4 requirement. This version of the same package was build to be compatible with laravel 7.X

Description
-----------

[](#description)

A Laravel package that provides easy access to the [php-tmdb/api](https://github.com/php-tmdb/api) TMDB (The Movie Database) API wrapper. This package comes with a service provider that configures the `Tmdb\Client` and registers it to the IoC container. Both Laravel 5 and 4 are supported.

[![Latest Stable Version](https://camo.githubusercontent.com/883225199bc974e520dc8dbf3e04b10334ee7fc442fdc83875cac232c8bd238c/68747470733a2f2f706f7365722e707567782e6f72672f7068702d746d64622f6c61726176656c2f762f737461626c652e737667)](https://packagist.org/packages/php-tmdb/laravel)[![Latest Unstable Version](https://camo.githubusercontent.com/12304c1eec08a55b0fd8524ee881ce0935b207838c93fb4fb806267572dc0beb/68747470733a2f2f706f7365722e707567782e6f72672f7068702d746d64622f6c61726176656c2f762f756e737461626c652e737667)](https://packagist.org/packages/php-tmdb/laravel)[![Dependency Status](https://camo.githubusercontent.com/3501f99cad587b6d57d4bc6c0c8540fcd75c93ac294a485a4e52c230669ee1b0/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f7068702d746d64623a6c61726176656c2f62616467653f7374796c653d666c6174)](https://www.versioneye.com/php/php-tmdb:laravel)[![Total Downloads](https://camo.githubusercontent.com/4630a7c75a7c726e745b302a55236a42de7b8bda21b7511fd07e1fe724d60e82/68747470733a2f2f706f7365722e707567782e6f72672f7068702d746d64622f6c61726176656c2f646f776e6c6f6164732e737667)](https://packagist.org/packages/php-tmdb/laravel)

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

[](#installation)

Install Composer

```
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

```

Add the following to your require block in `composer.json` config

```
"webrussell/php-tmdb": "~1.0"

```

or just run the following command in your project:

```
composer require webrussell/php-tmdb

```

Configuration
-------------

[](#configuration)

Add to your `app/config/app.php` (Laravel 4) or `config/app.php` (Laravel &lt;5.5) the service provider:

```
'providers' => array(
    // other service providers

    'Tmdb\Laravel\TmdbServiceProvider',
)
```

Then publish the configuration file:

### Laravel 7

[](#laravel-7)

```
php artisan vendor:publish --provider="Tmdb\Laravel\TmdbServiceProviderLaravel5"

```

Next you can modify the generated configuration file `tmdb.php` accordingly.

That's all! Fire away!

Usage
-----

[](#usage)

We can choose to either use the `Tmdb` Facade, or to use dependency injection.

### Facade example

[](#facade-example)

The example below shows how you can use the `Tmdb` facade. If you don't want to keep adding the `use Tmdb\Laravel\Facades\Tmdb;` statement in your files, then you can also add the facade as an alias in `config/app.php` file.

```
use Tmdb\Laravel\Facades\Tmdb; // optional for Laravel ≥5.5

class MoviesController {

    function show($id)
    {
        // returns information of a movie
        return Tmdb::getMoviesApi()->getMovie($id);
    }
}
```

### Dependency injection example

[](#dependency-injection-example)

```
use Tmdb\Repository\MovieRepository;

class MoviesController {

    private $movies;

    function __construct(MovieRepository $movies)
    {
        $this->movies = $movies;
    }

    function index()
    {
        // returns information of a movie
        return $this->movies->getPopular();
    }
}
```

### Listening to events

[](#listening-to-events)

We can easily listen to events that are dispatched using the Laravel event dispatcher that we're familiar with. The following example listens to any request that is made and logs a message.

```
use Log;
use Event;
use Tmdb\Event\TmdbEvents;
use Tmdb\Event\RequestEvent;

Event::listen(TmdbEvents::REQUEST, function(RequestEvent $event) {
    Log::info("A request was made to TMDB");
    // do stuff with $event
});
```

In Laravel 5 instead of using the `Event` facade we could also have used the `EventServiceProvider` to register our event listener.

### Image helper

[](#image-helper)

You can easily use the `ImageHelper` by using dependency injection. The following example shows how to show the poster image of the 20 most popular movies.

```
namespace App\Http\Controllers;

use Tmdb\Helper\ImageHelper;
use Tmdb\Repository\MovieRepository;

class WelcomeController extends Controller {

    private $movies;
    private $helper;

    public function __construct(MovieRepository $movies, ImageHelper $helper)
    {
        $this->movies = $movies;
        $this->helper = $helper;
    }

    /**
     * Show the application welcome screen to the user.
     *
     * @return Response
     */
    public function index()
    {
        $popular = $this->movies->getPopular();

        foreach ($popular as $movie)
        {
            $image = $movie->getPosterImage();
            echo ($this->helper->getHtml($image, 'w154', 260, 420));
        }
    }

}
```

The `Configuration` used by the `Tmdb\Helper\ImageHelper` is automatically loaded by the IoC container. If you are a Laravel 5.1 user you could also use the blade's `@inject` functionality,

```
@inject('image', 'Tmdb\Helper\ImageHelper')

@foreach ($movies as $movie)
    {!! $image->getHtml($movie->getPosterImage(), 'w154', 260, 420) !!}
@endforeach

```

### Registering plugins

[](#registering-plugins)

Plugins can be registered in a service provider using the `boot()` method.

```
namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Tmdb\HttpClient\Plugin\LanguageFilterPlugin;

class TmdbServiceProvider extends ServiceProvider {

    /**
     * Add a Dutch language filter to the Tmdb client
     *
     * @return void
     */
    public function boot()
    {
        $plugin = new LanguageFilterPlugin('nl');
        $client = $this->app->make('Tmdb\Client');
        $client->getHttpClient()->addSubscriber($plugin);
    }

    /**
     * Register services
     * @return void
     */
    public function register()
    {
        // register any services that you need
    }
}
```

**For all all other interactions take a look at [php-tmdb/api](https://github.com/php-tmdb/api).**

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 52.2% 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 ~146 days

Recently: every ~397 days

Total

15

Last Release

2199d ago

Major Versions

v0.1.3 → v1.0.02015-04-04

v1.1.2 → v2.0.02020-05-01

PHP version history (2 changes)v0.1PHP &gt;=5.4.0

v2.0.0PHP &gt;=7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/75385092?v=4)[webrussell](/maintainers/webrussell)[@webrussell](https://github.com/webrussell)

---

Top Contributors

[![MarkRedeman](https://avatars.githubusercontent.com/u/1114829?v=4)](https://github.com/MarkRedeman "MarkRedeman (35 commits)")[![wtfzdotnet](https://avatars.githubusercontent.com/u/639376?v=4)](https://github.com/wtfzdotnet "wtfzdotnet (12 commits)")[![yukoff](https://avatars.githubusercontent.com/u/1076681?v=4)](https://github.com/yukoff "yukoff (9 commits)")[![webrussell](https://avatars.githubusercontent.com/u/75385092?v=4)](https://github.com/webrussell "webrussell (5 commits)")[![z38](https://avatars.githubusercontent.com/u/3948085?v=4)](https://github.com/z38 "z38 (2 commits)")[![okaufmann](https://avatars.githubusercontent.com/u/4414498?v=4)](https://github.com/okaufmann "okaufmann (1 commits)")[![florentsorel](https://avatars.githubusercontent.com/u/1011503?v=4)](https://github.com/florentsorel "florentsorel (1 commits)")[![hiddeco](https://avatars.githubusercontent.com/u/10063039?v=4)](https://github.com/hiddeco "hiddeco (1 commits)")[![broomcms](https://avatars.githubusercontent.com/u/63425041?v=4)](https://github.com/broomcms "broomcms (1 commits)")

---

Tags

phpapilaravelwrappermovietv showtvtvdbtmdb

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[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)[dariusiii/tmdb-laravel

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

1821.1k](/packages/dariusiii-tmdb-laravel)[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)[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.

4242.9k](/packages/wtfzdotnet-php-tmdb-api)[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)[codebuglab/laravel-tmdb

Simple integration with TMDB ( The Movie Database ) API to retrieve their data.

145.5k](/packages/codebuglab-laravel-tmdb)

PHPackages © 2026

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