An open API service indexing awesome lists of open source software.

https://github.com/mcred/cakephp-tmdb-api-plugin

A CakePHP Plugin to interact with the TMDb API.
https://github.com/mcred/cakephp-tmdb-api-plugin

Last synced: about 1 year ago
JSON representation

A CakePHP Plugin to interact with the TMDb API.

Awesome Lists containing this project

README

          

CakePHP-TMDB-API-Plugin
=======================

A CakePhp Plugin that interacts with the API from themoviedb.org. The component will get/post data to/from the API and return an array to the controller. The helper will fetch the image from the API and save a local version for future use. Images cached from the API expire after 30 days and will be fetched again.

#Requirements#
*PHP 4,5

*CakePhp 2+

*TMDb API key

#Installation#
```
$ cd /your_CakePHP_root/
$ git submodule add git@github.com:mcred/CakePHP-TMDB-API-Plugin.git app/Plugin/Tmdb
```

#Configuration#
1. Create an account at http://www.themoviedb.org/
2. Obtain your API key
3. Create a copy of tmdb.php to /app/Config/tmdb.php
4. Insert your API Key and update any settings
5. Edit your /app/Controller/AppController.php

```
class AppController extends Controller {
public $components = array('Tmdb.Tmdb');
public $helpers = array('Tmdb.Tmdb');
}
```

#Usage#
The general convention the the plugin follows matches the usage for the API. For a full list of functions, either see the component or read the list at http://docs.themoviedb.apiary.io/

Get /3/movie/{id} becomes
```
$this->Tmdb->getMovie($id,[$options]);
```
Get /3/movie/{id}/images becomes
```
$this->Tmdb->getMovieImages($id,[$options]);
```

#Example#
Get Movie Information for your Controller
```
$movies = $this->Tmdb->getMovie(550,array('append_to_response'=>'trailers'));
debug($movies);
```

Display Movie Poster from your View
```
echo $this->Tmdb->GetMovieImage('/2lECpi35Hnbpa4y46JX0aY3AWTy.jpg','w342','Fight Club');
```

#Change History#
CakePHP TMDB v.1 - 2013-10-25

*Initial Committ