PHP code example of chiiya / tmdb-php

1. Go to this page and download the library: Download chiiya/tmdb-php 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/ */

    

chiiya / tmdb-php example snippets


use Chiiya\Tmdb\Http\Client;
use Chiiya\Tmdb\Repositories\MovieRepository;

$client = Client::createAuthenticatedClient('your_v4_bearer_token');
$repository = new MovieRepository($client);
$movie = $repository->getMovie(550);
dump($movie->title); // "Fight Club"

$movie = $this->movies->getMovie(550, [
    new AppendToResponse([
        AppendToResponse::IMAGES,
        AppendToResponse::WATCH_PROVIDERS,
    ]),
]);
$movie->watch_providers['US']->flatrate[0]->provider_name;

$repository->getPopular();
$repository->getNowPlaying();
// ...
bash
composer