PHP code example of ramshackleb3 / bdmi

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

    

ramshackleb3 / bdmi example snippets


$title = new \Imdb\Title(335266);
$rating = $title->rating();
$plotOutline = $title->plotoutline();

# Find out about the director
$person = new \Imdb\Person($title->director()[0]['imdb']);
$name = $person->name();
$photo = $person->photo();

$config = new \Imdb\Config();
$config->language = 'de-DE,de,en';
$imdb = new \Imdb\Title(335266, $config);
$imdb->title(); // Lost in Translation - Zwischen den Welten
$imdb->orig_title(); // Lost in Translation

$cache = new \Cache\Adapter\PHPArray\ArrayCachePool();
// Search results will be cached
$search = new \Imdb\TitleSearch(null /* config */, null /* logger */, $cache);
$firstResultTitle = $search->search('The Matrix')[0];
// $firstResultTitle, an \Imdb\Title will also be using $cache for caching any page requests it does

$cache = new \Cache\Adapter\PHPArray\ArrayCachePool();
$title = new \Imdb\Title(335266, null /* config */, null /* logger */, $cache);

$logger = new \Monolog\Logger('name');
$title = new \Imdb\Title(335266, null /* config */, $logger);

// earch = new \Imdb\TitleSearch(); // Optional $config parameter
$results = $search->search('The Matrix', array(\Imdb\TitleSearch::MOVIE)); // Optional second parameter restricts types returned

// $results is an array of Title objects
// The objects will have title, year and movietype available
// immediately, but any other data will have to be fetched from IMDb
foreach ($results as $result) { /* @var $result \Imdb\Title */
    echo $result->title() . ' ( ' . $result->year() . ')';
}

// earch = new \Imdb\PersonSearch(); // Optional $config parameter
$results = $search->search('Forest Whitaker');

// $results is an array of Person objects
// The objects will have name and imdbid available, everything else must be fetched from IMDb
foreach ($results as $result) { /* @var $result \Imdb\Person */
    echo $result->name();
}

$config = new \Imdb\Config();
$config->language = 'de-DE,de,en';
$imdb = new \Imdb\Title(335266, $config);
$imdb->title(); // Lost in Translation - Zwischen den Welten
$imdb->orig_title(); // Lost in Translation