Skip to content

Latest commit

 

History

History
55 lines (36 loc) · 1.2 KB

README.md

File metadata and controls

55 lines (36 loc) · 1.2 KB

TheMovieDatabase plugin for CakePHP

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require cakephp-fr/the-movie-database

Before you can do any request you need set information :

// in config/app.php
    'Datasources' => [
        // other datasources
        'theMovieDatabase' => [
            'className' => 'TheMovieDatabase\Datasource\Connection',
            'driver' => 'TheMovieDatabase\Datasource\Connection',
            'apiKey' => '************',
            'lang' => 'fr'
        ],
    ]

Usage

// in your controller
use Cake\Datasource\ConnectionManager;

class MyController extends AppController {

	public function index() {

		$conn = ConnectionManager::get('theMovieDatabase'); // get the connection

        $tvShow = $conn->searchTv('supernatural'); // execute a query

        debug($tvShow); // watch the result

	}

}

Watch source Datasource/Connection.php for other query

Resource

You can get your api key here.

For more information here.