PHPackages                             drmonkeyninja/cakephp-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. drmonkeyninja/cakephp-tmdb

ActiveCakephp-plugin[API Development](/categories/api)

drmonkeyninja/cakephp-tmdb
==========================

CakePHP TMDB API integration

3.1.1(7y ago)4441[1 issues](https://github.com/drmonkeyninja/cakephp-tmdb/issues)MITPHP

Since Dec 8Pushed 7y ago3 watchersCompare

[ Source](https://github.com/drmonkeyninja/cakephp-tmdb)[ Packagist](https://packagist.org/packages/drmonkeyninja/cakephp-tmdb)[ Docs](https://github.com/drmonkeyninja/cakephp-tmdb)[ RSS](/packages/drmonkeyninja-cakephp-tmdb/feed)WikiDiscussions master Synced 4w ago

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

CakePHP TMDB
============

[](#cakephp-tmdb)

[![License](https://camo.githubusercontent.com/e3bfe792e6b3584236b7e0c3bec03d33d17c8b4fdb762f443a2434b61f361ab2/68747470733a2f2f706f7365722e707567782e6f72672f64726d6f6e6b65796e696e6a612f63616b657068702d746d64622f6c6963656e73652e737667)](https://packagist.org/packages/drmonkeyninja/cakephp-tmdb) [![Build Status](https://camo.githubusercontent.com/5e67fe0d0611d1c0a92e3e8d22ef2d8b6584d82ef7b5139ff7c2ed0404dc0d39/68747470733a2f2f7472617669732d63692e6f72672f64726d6f6e6b65796e696e6a612f63616b657068702d746d64622e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/drmonkeyninja/cakephp-tmdb)

This CakePHP 3 plugin provides integration with the TMDB API for retrieving data on movies and television from [themoviedb.org](https://www.themoviedb.org/). It makes use of an established [TMDB API wrapper](https://github.com/php-tmdb/api) and the [Webservice](https://github.com/UseMuffin/Webservice) plugin for CakePHP.

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

[](#requirements)

- CakePHP 3.x
- A valid TMDB API key

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

[](#installation)

Install using composer: `composer require drmonkeyninja/cakephp-tmdb:3.0.*`

Then add the following lines to bootstrap.php to load the plugin:

```
Plugin::load('Muffin/Webservice');
Plugin::load('CakeTmdb');
```

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

[](#configuration)

You will need to configure a new webservice in config/app.php using your TMDB API key:

```
'Webservices' => [
    'Tmdb' => [
        'className' => 'Muffin\Webservice\Connection',
        'service' => 'CakeTmdb\Lib\Tmdb\Driver\Tmdb',
        'api_key' => 'your_tmdb_api_key'
    ]
]
```

Then in bootstrap.php instruct the `ConnectionManager` to consume the webservice:

```
ConnectionManager::setConfig(Configure::consume('Webservices'));
```

Usage
-----

[](#usage)

This plugin uses the [TMDB API library](https://github.com/php-tmdb/api) so you have full access to all of the methods provided there.

For example, to search the database for movies with the title 'Toy Story':

```
$tmdb = \Cake\Datasource\ConnectionManager::get('Tmdb');
$data = $tmdb->getSearchApi()->searchMovies('Toy Story');
```

### TmdbHelper

[](#tmdbhelper)

A handy little helper comes with the plugin for rendering TMDB images using the paths returned by the API. To use include the `Tmdb` helper in your controller as normal:-

```
public $helpers = ['CakeTmdb.Tmdb'];
```

Then in your view:-

```
