PHP code example of angelxmoreno / cakephp-tmdb-datasource

1. Go to this page and download the library: Download angelxmoreno/cakephp-tmdb-datasource library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

angelxmoreno / cakephp-tmdb-datasource example snippets


public $tmdb = array(
	'datasource' => 'TmdbApi.TmdbSource',
	'apiKey' => 'YOUR-API-KEY',
);

class TmdbMovie extends AppModel {
	public $useDbConfig = 'tmdb';
	public $useTable = 'movies';
}

$results = $this->TmdbMovie->read(null, 550);
debug($results);

$results = $this->TmdbMovie->find('first', array('conditions'=>array(
	'query'=>'Terminator',
	'append_to_response' => array('images'),
)));
debug($results);

$results = $this->TmdbMovie->find('all', array('conditions'=>array(
	'query'=>'Batman',
	'append_to_response' => true,//will auto append all applicable calls
)));
debug($results);