1. Go to this page and download the library: Download kiwilan/php-tmdb 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/ */
kiwilan / php-tmdb example snippets
use Kiwilan\Tmdb\Tmdb;
$results = Tmdb::client('API_KEY')
->search()
->movie(query: 'the lord of the rings'); // ?\Kiwilan\Tmdb\Results\MovieResults
use Kiwilan\Tmdb\Tmdb;
$collection = Tmdb::client('API_KEY')
->collections()
->details(collection_id: 119); // ?\Kiwilan\Tmdb\Models\TmdbCollection
use Kiwilan\Tmdb\Tmdb;
$movie = Tmdb::client('API_KEY')
->movies()
->details(movie_id: 120); // ?\Kiwilan\Tmdb\Models\TmdbMovie
use Kiwilan\Tmdb\Tmdb;
$network = Tmdb::client('API_KEY')
->networks()
->details(network_id: 49); // ?\Kiwilan\Tmdb\Models\TvSeries\TmdbNetwork
use Kiwilan\Tmdb\Tmdb;
$results = Tmdb::client('API_KEY')
->search()
->movie(query: 'the lord of the rings');
$collections = $results->getResults(); // \Kiwilan\Tmdb\Models\TmdbCollection[]
$firstCollection = $results->getFirstResult(); // ?\Kiwilan\Tmdb\Models\TmdbCollection
use Kiwilan\Tmdb\Tmdb;
use Kiwilan\Tmdb\Query\SearchCollectionQuery;
$results = Tmdb::client('API_KEY')
->search()
->collection(query: 'le seigneur des anneaux', params: new SearchCollectionQuery(
use Kiwilan\Tmdb\Tmdb;
$results = Tmdb::client('API_KEY')
->search()
->movie(query:'the fellowship of the ring');
$movies = $results->getResults(); // \Kiwilan\Tmdb\Models\TmdbMovie[]
$firstMovie = $results->getFirstResult(); // ?\Kiwilan\Tmdb\Models\TmdbMovie
use Kiwilan\Tmdb\Tmdb;
use Kiwilan\Tmdb\Query\SearchMovieQuery;
$results = Tmdb::client('API_KEY')
->search()
->movie(query: 'le seigneur des anneaux', params: new SearchMovieQuery(
use Kiwilan\Tmdb\Tmdb;
$results = Tmdb::client('API_KEY')
->search()
->tv(query: 'game of thrones');
$tvSeries = $results->getResults(); // \Kiwilan\Tmdb\Models\TmdbTvSeries[]
$firstTvSeries = $results->getFirstResult(); // ?\Kiwilan\Tmdb\Models\TmdbTvSeries
use Kiwilan\Tmdb\Tmdb;
use Kiwilan\Tmdb\Query\SearchTvSeriesQuery;
$results = Tmdb::client('API_KEY')
->search()
->tv(query: 'game of thrones', params: new SearchTvSeriesQuery(
first_air_date_year: 2011,
use Kiwilan\Tmdb\Tmdb;
$all = Tmdb::client('API_KEY')
->trending()
->all(); // ?\Kiwilan\Tmdb\Results\MediaResults
use Kiwilan\Tmdb\Tmdb;
$movies = Tmdb::client('API_KEY')
->trending()
->movies(); // ?\Kiwilan\Tmdb\Results\MovieResults
use Kiwilan\Tmdb\Tmdb;
$people = Tmdb::client('API_KEY')
->trending()
->people(); // ?\Kiwilan\Tmdb\Results\PeopleResults
use Kiwilan\Tmdb\Tmdb;
$tv = Tmdb::client('API_KEY')
->trending()
->tv(); // ?\Kiwilan\Tmdb\Results\TvSerieResults