### Start Demo Webserver Source: https://github.com/tboothman/imdbphp/blob/master/README.md Run the built-in PHP webserver from the demo directory to test the library. ```bash php -S localhost:8000 ``` -------------------------------- ### Install IMDbPHP using Composer Source: https://context7.com/tboothman/imdbphp/llms.txt Install the IMDbPHP library using Composer to manage dependencies and autoloading. ```bash composer require imdbphp/imdbphp ``` -------------------------------- ### Install and Run Tests with Composer Source: https://github.com/tboothman/imdbphp/blob/master/tests/readme.md Use Composer to install dependencies and run the test suite from the project's root directory. ```bash composer install composer test ``` -------------------------------- ### Retrieve Ratings and Parental Guides Source: https://context7.com/tboothman/imdbphp/llms.txt Fetch MPAA ratings and detailed parental guidance content warnings. ```php mpaa(); foreach ($mpaa as $country => $rating) { echo "$country: $rating\n"; } // Get all ratings (including historical) $mpaaAll = $title->mpaa(true); // Returns array of ratings per country // Get MPAA rating reason $reason = $title->mpaa_reason(); echo "Rating reason: $reason\n"; // Get detailed parental guide $parentalGuide = $title->parentalGuide(); foreach ($parentalGuide as $category => $items) { echo "$category:\n"; foreach ($items as $item) { echo " - $item\n"; } } // Categories: Sex, Violence, Profanity, Drugs, Frightening // Get spoiler parental guide $spoilerGuide = $title->parentalGuide(true); ``` -------------------------------- ### Get Basic Title Information with IMDbPHP Source: https://context7.com/tboothman/imdbphp/llms.txt Use the Title class to retrieve basic movie or TV show metadata by providing its IMDb ID. Ensure you have included the Composer autoloader. ```php title(); // "Lost in Translation" $year = $title->year(); // 2003 $rating = $title->rating(); // 7.7 $votes = $title->votes(); // 453287 $runtime = $title->runtime(); // 102 (minutes) $movieType = $title->movietype(); // "Movie" // Get plot and description $plotOutline = $title->plotoutline(); // Short description $storyline = $title->storyline(); // Longer plot summary $synopsis = $title->synopsis(); // Full synopsis // Get genres, languages, and countries $genres = $title->genres(); // ["Drama", "Romance", "Comedy"] $genre = $title->genre(); // "Drama" (first genre) $languages = $title->languages(); // ["English", "Japanese"] $countries = $title->country(); // ["United States", "Japan"] // Get tagline $tagline = $title->tagline(); // Main tagline $taglines = $title->taglines(); // All taglines echo "Title: $movieTitle ($year)\n"; echo "Rating: $rating/10 ($votes votes)\n"; echo "Runtime: $runtime minutes\n"; echo "Genres: " . implode(", ", $genres) . "\n"; ``` -------------------------------- ### Get Person Information Source: https://context7.com/tboothman/imdbphp/llms.txt Retrieve detailed information about a person using their IMDb ID. Includes basic info, birth/death details, bio, spouses, and salaries. ```php name(); // "Keanu Reeves" $photo = $person->photo(); // Thumbnail URL $photoBig = $person->photo(false); // Full-size photo URL $realId = $person->real_id(); // Actual IMDb ID (handles redirects) // Birth and death information $born = $person->born(); if ($born) { echo "Born: " . $born['month'] . " " . $born['day'] . ", " . $born['year'] . "\n"; echo "Birthplace: " . $born['place'] . "\n"; } $died = $person->died(); if ($died) { echo "Died: " . $died['month'] . " " . $died['day'] . ", " . $died['year'] . "\n"; echo "Cause: " . $died['cause'] . "\n"; } // Bio page information $birthName = $person->birthname(); // Birth name if different $nicknames = $person->nickname(); // Array of nicknames $height = $person->height(); // ['imperial' => "6' 1\"", 'metric' => '1.86 m'] $bio = $person->bio(); // Mini biography with author info $trivia = $person->trivia(); // Array of trivia items $quotes = $person->quotes(); // Personal quotes $trademarks = $person->trademark(); // Signature characteristics // Spouse information $spouses = $person->spouse(); foreach ($spouses as $spouse) { echo $spouse['name'] . " (" . $spouse['from']['year'] . "-" . $spouse['to']['year'] . ")\n"; echo " Children: " . $spouse['children'] . "\n"; echo " Note: " . $spouse['comment'] . "\n"; } // Salary information $salaries = $person->salary(); foreach ($salaries as $salary) { echo $salary['movie']['name'] . " (" . $salary['movie']['year'] . "): " . $salary['salary'] . "\n"; } ``` -------------------------------- ### Get Film Metadata with imdbphp Source: https://github.com/tboothman/imdbphp/blob/master/README.md Instantiate a Title object with an IMDb ID to retrieve various metadata like rating and plot outline. You can also fetch information about the director. ```php $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(); ``` -------------------------------- ### Get Person Filmography Source: https://context7.com/tboothman/imdbphp/llms.txt Retrieve a person's complete filmography, categorized by their roles (actor, director, producer, etc.). ```php movies_all(); // Get acting credits $actingCredits = $person->movies_actor(); foreach ($actingCredits as $film) { echo $film['name'] . " (" . $film['year'] . ")\n"; echo " IMDb ID: tt" . $film['mid'] . "\n"; echo " Type: " . $film['title_type'] . "\n"; echo " Character: " . $film['chname'] . "\n"; if ($film['chid']) { echo " Character ID: ch" . $film['chid'] . "\n"; } if (!empty($film['addons'])) { echo " Notes: " . implode(", ", $film['addons']) . "\n"; } } // Other filmography categories $directorCredits = $person->movies_director(); $producerCredits = $person->movies_producer(); $writerCredits = $person->movies_writer(); $soundtrackCredits = $person->movies_soundtrack(); $crewCredits = $person->movies_crew(); // Miscellaneous crew $thanksCredits = $person->movies_thanx(); // Special thanks $selfCredits = $person->movies_self(); // Appearing as themselves $archiveCredits = $person->movies_archive(); // Archive footage ``` -------------------------------- ### Implement Custom Logging Source: https://context7.com/tboothman/imdbphp/llms.txt Integrate PSR-3 compatible loggers like Monolog to track library activity. ```php pushHandler(new StreamHandler('/path/to/imdb.log', Logger::DEBUG)); // Use logger with Title $title = new \Imdb\Title(335266, null, $logger); // Use logger with search $search = new \Imdb\TitleSearch(null, $logger); // Log levels used by IMDbPHP: // - ERROR: HTTP request failures // - INFO: Each HTTP request made // - DEBUG: Cache hits and other detailed info ``` -------------------------------- ### Implement Custom Caching Source: https://context7.com/tboothman/imdbphp/llms.txt Replace the default disk cache with any PSR-16 compatible cache adapter. ```php connect('127.0.0.1', 6379); // $cache = new RedisCachePool($redis); // Pass cache to Title $title = new \Imdb\Title(335266, null, null, $cache); // Pass cache to TitleSearch - results and subsequent requests use same cache $search = new \Imdb\TitleSearch(null, null, $cache); $results = $search->search('The Matrix'); // The Title objects returned also use the same cache $firstResult = $results[0]; echo $firstResult->rating(); // Uses the cache ``` -------------------------------- ### Run Tests with PHPUnit Phar Source: https://github.com/tboothman/imdbphp/blob/master/tests/readme.md Execute the test suite using the PHPUnit phar archive. Ensure you have the phar downloaded from GitHub. ```bash php phpunit.phar -c tests/phpunit.xml tests ``` -------------------------------- ### Configure cURL SSL Certificates Source: https://github.com/tboothman/imdbphp/blob/master/README.md Update php.ini to point to a valid cacert.pem file to resolve SSL certificate issues on Windows. ```ini [curl] curl.cainfo = "C:\php\extras\ssl\cacert.pem" ``` -------------------------------- ### Configure Library Behavior Source: https://context7.com/tboothman/imdbphp/llms.txt Customize library settings including language, caching, image storage, proxy, and debug modes using the Config class. ```php language = 'de-DE,de,en'; // Cache settings $config->cachedir = '/path/to/cache/'; $config->usecache = true; $config->storecache = true; $config->cache_expire = 604800; // 1 week in seconds $config->usezip = true; // Compress cached files // Image storage settings $config->photodir = '/path/to/images/'; $config->photoroot = '/images/'; // Proxy settings $config->use_proxy = true; $config->proxy_host = 'proxy.example.com'; $config->proxy_port = 8080; $config->proxy_user = 'username'; $config->proxy_pw = 'password'; // IP spoofing (for geo-location) $config->ip_address = '203.0.113.50'; // Debug mode $config->debug = true; $config->throwHttpExceptions = true; // Custom user agent $config->force_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'; // Use the config $title = new \Imdb\Title(335266, $config); echo $title->title(); // German title if available echo $title->orig_title(); // Original title ``` -------------------------------- ### Configure and Initialize ImdbPHP Source: https://github.com/tboothman/imdbphp/blob/master/README.md Modify the Config object properties before passing it to the Title constructor to customize language settings. ```php $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 ``` -------------------------------- ### Configure Custom Logger Source: https://github.com/tboothman/imdbphp/blob/master/README.md Pass a PSR-3 compatible logger to the constructor to track HTTP requests and cache events. ```php $logger = new \Monolog\Logger('name'); $title = new \Imdb\Title(335266, null /* config */, $logger); ``` -------------------------------- ### Implement PSR-16 Caching Source: https://github.com/tboothman/imdbphp/blob/master/README.md Inject a PSR-16 compatible cache pool into the constructor of search or title classes to override the default disk cache. ```php $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 ``` ```php $cache = new \Cache\Adapter\PHPArray\ArrayCachePool(); $title = new \Imdb\Title(335266, null /* config */, null /* logger */, $cache); ``` -------------------------------- ### Retrieve Technical Specifications Source: https://context7.com/tboothman/imdbphp/llms.txt Fetch technical details such as runtime, aspect ratio, color, sound formats, filming locations, dates, and budget. ```php runtime(); // Minutes as integer echo "Runtime: $runtime minutes\n"; // Get all runtimes (different cuts) $runtimes = $title->runtimes(); foreach ($runtimes as $rt) { echo $rt['time'] . " min"; if ($rt['country']) { echo " (" . $rt['country'] . ")"; } if (!empty($rt['annotations'])) { echo " - " . implode(", ", $rt['annotations']); } echo "\n"; } // Get aspect ratio $aspectRatio = $title->aspect_ratio(); // e.g., "2.39 : 1" // Get colors $colors = $title->colors(); // ["Color"] // Get sound formats $sound = $title->sound(); // ["Dolby Digital", "SDDS", "DTS"] // Get filming locations $locations = $title->locations(); foreach ($locations as $location) { echo "Filmed at: $location\n"; } // Get filming dates $filmingDates = $title->filmingDates(); if ($filmingDates) { echo "Filming: " . $filmingDates['beginning'] . " to " . $filmingDates['end'] . "\n"; } // Get budget $budget = $title->budget(); if ($budget) { echo "Budget: $" . number_format($budget) . "\n"; } ``` -------------------------------- ### Retrieve Release Information and Alternative Titles Source: https://context7.com/tboothman/imdbphp/llms.txt Access release dates by country and alternative titles (AKAs) for a title. ```php releaseInfo(); foreach ($releases as $release) { $date = $release['year'] . '-' . $release['mon'] . '-' . $release['day']; echo $release['country'] . ": $date\n"; if ($release['comment']) { echo " Note: " . $release['comment'] . "\n"; } if (!empty($release['attributes'])) { echo " Attributes: " . implode(", ", $release['attributes']) . "\n"; } } // Get alternative titles (AKAs) $akas = $title->alsoknow(); foreach ($akas as $aka) { echo $aka['title'] . " (" . $aka['country'] . ")\n"; echo " Language: " . $aka['language'] . " (" . $aka['languageCode'] . ")\n"; if ($aka['comment']) { echo " Comment: " . $aka['comment'] . "\n"; } } ``` -------------------------------- ### Retrieve Company Credits Source: https://context7.com/tboothman/imdbphp/llms.txt Fetches production, distribution, and other company-related information for a title. ```php prodCompany(); foreach ($prodCompanies as $company) { echo $company['name'] . "\n"; echo " URL: " . $company['url'] . "\n"; echo " Notes: " . $company['notes'] . "\n"; } // Distribution companies $distCompanies = $title->distCompany(); // Special effects companies $sfxCompanies = $title->specialCompany(); // Other companies $otherCompanies = $title->otherCompany(); ``` -------------------------------- ### Retrieve TV Series Episodes and Details Source: https://context7.com/tboothman/imdbphp/llms.txt Use the Imdb\Title class to fetch episode lists for series or specific episode metadata. ```php is_serial()) { // Get number of seasons $seasons = $title->seasons(); echo "Total seasons: $seasons\n"; // Get all episodes $episodes = $title->episodes(); foreach ($episodes as $seasonNum => $seasonEpisodes) { echo "Season $seasonNum:\n"; foreach ($seasonEpisodes as $epNum => $episode) { echo " S{$seasonNum}E{$epNum}: " . $episode['title'] . "\n"; echo " IMDb ID: tt" . $episode['imdbid'] . "\n"; echo " Air Date: " . $episode['airdate'] . "\n"; echo " Plot: " . substr($episode['plot'], 0, 100) . "...\n"; echo " Image: " . $episode['image_url'] . "\n"; } } } // For a specific episode $episode = new \Imdb\Title(4283088); // A specific episode if ($episode->isEpisode()) { echo "Episode Title: " . $episode->episodeTitle() . "\n"; echo "Season: " . $episode->episodeSeason() . "\n"; echo "Episode: " . $episode->episodeEpisode() . "\n"; echo "Air Date: " . $episode->episodeAirDate() . "\n"; // Get parent series information $details = $episode->get_episode_details(); echo "Series: " . $details['seriestitle'] . " (tt" . $details['imdbid'] . ")\n"; } ``` -------------------------------- ### Retrieve External Sites and Reviews Source: https://context7.com/tboothman/imdbphp/llms.txt Access official websites, external reviews, video links, and trailer details for a specific movie title. ```php officialSites(); foreach ($officialSites as $site) { echo $site['name'] . ": " . $site['url'] . "\n"; } // Get external reviews $reviews = $title->extReviews(); foreach ($reviews as $review) { echo $review['desc'] . ": " . $review['url'] . "\n"; } // Get video sites (trailers on external sites) $videoSites = $title->videosites(); foreach ($videoSites as $site) { echo $site['desc'] . " (" . $site['language'] . "): " . $site['url'] . "\n"; } // Get trailer URLs (IMDb hosted) $trailers = $title->trailers(); foreach ($trailers as $trailer) { echo "Trailer: $trailer\n"; } // Get trailers with full details $trailersDetailed = $title->trailers(true); foreach ($trailersDetailed as $trailer) { echo $trailer['title'] . " [" . $trailer['resolution'] . "]: " . $trailer['url'] . "\n"; } ``` -------------------------------- ### Retrieve TV Series Creators Source: https://context7.com/tboothman/imdbphp/llms.txt Fetch the creator information for a TV series using the creator() method. ```php creator(); foreach ($creators as $creator) { echo "Creator: " . $creator['name'] . " (nm" . $creator['imdb'] . ")\n"; } ``` -------------------------------- ### Advanced Title Search with Filters and Sorting Source: https://context7.com/tboothman/imdbphp/llms.txt Use TitleSearchAdvanced to filter titles by keywords, year, type, country, and language, then sort the results by user rating or other criteria. Ensure the vendor autoloader is included. ```php setTitle('action'); // Title contains "action" $search->setYear(2023); // Released in 2023 $search->setTitleTypes([ Imdb TitleSearchAdvanced::MOVIE]); // Only movies $search->setCountries(['US']); // From USA $search->setLanguages(['en']); // In English $search->setSort( Imdb TitleSearchAdvanced::SORT_USER_RATING); // Sort by rating // Available sort options: // SORT_MOVIEMETER, SORT_ALPHA, SORT_USER_RATING, SORT_NUM_VOTES, // SORT_US_BOX_OFFICE_GROSS, SORT_RUNTIME, SORT_YEAR, SORT_RELEASE_DATE // Perform the search $results = $search->search(); // Results are arrays with detailed information foreach ($results as $result) { echo $result['rank'] . '. ' . $result['title'] . ' (' . $result['year'] . ")\n"; echo " IMDb ID: " . $result['imdbid'] . "\n"; echo " Type: " . $result['type'] . "\n"; echo " Is Serial: " . ($result['serial'] ? 'Yes' : 'No') . "\n"; // For TV episodes, additional info is available if ($result['episode_imdbid']) { echo " Episode: " . $result['episode_title'] . " (tt" . $result['episode_imdbid'] . ")\n"; } } ``` -------------------------------- ### Manage Movie and Person Images Source: https://context7.com/tboothman/imdbphp/llms.txt Retrieve and save posters or person photos using the photo() and savephoto() methods. ```php photo(true); // Thumbnail (182x268) $fullUrl = $title->photo(false); // Full size (original) if ($thumbUrl) { echo "Thumbnail: $thumbUrl\n"; } if ($fullUrl) { echo "Full poster: $fullUrl\n"; } // Save poster to disk $success = $title->savephoto('/path/to/save/poster.jpg', false); // Get local URL (saves image if not exists) $localUrl = $title->photo_localurl(true); // Thumbnail $localUrlBig = $title->photo_localurl(false); // Full size // For Person images $person = new \Imdb\Person(206); $personPhoto = $person->photo(true); // Thumbnail $personPhotoBig = $person->photo(false); // Full size $person->savephoto('/path/to/save/actor.jpg', false); ``` -------------------------------- ### Retrieve Top 250 and Charts Source: https://context7.com/tboothman/imdbphp/llms.txt Accesses Top 250 rankings, MOVIEmeter charts, and box office information. ```php top250(); if ($position > 0) { echo "Top 250 Position: #$position\n"; } // Get MOVIEmeter Top 10 $charts = new \Imdb\Charts(); $top10 = $charts->getChartsTop10(); foreach ($top10 as $index => $imdbId) { $title = new \Imdb\Title($imdbId); echo ($index + 1) . ". " . $title->title() . " (tt$imdbId)\n"; } // Get Box Office chart $boxOffice = $charts->getChartsBoxOffice(); foreach ($boxOffice as $entry) { $title = new \Imdb\Title($entry['id']); echo $title->title() . "\n"; echo " Weekend: $" . $entry['weekend'] . "M\n"; echo " Gross: $" . $entry['gross'] . "M\n"; } ``` -------------------------------- ### Retrieve Movie Connections Source: https://context7.com/tboothman/imdbphp/llms.txt Retrieves related movies such as sequels, remakes, and references. ```php movieconnection(); // Connection types available: // followedBy, follows, remadeAs, remakeOf, spinOff, spinOffFrom, // references, referenced, features, featured, spoofs, spoofed, // editedFrom, editedInto, versionOf, alternate_language_version_of foreach ($connections['followedBy'] as $sequel) { echo "Followed by: " . $sequel['name'] . " (" . $sequel['year'] . ")\n"; echo " IMDb ID: tt" . $sequel['mid'] . "\n"; if ($sequel['comment']) { echo " Note: " . $sequel['comment'] . "\n"; } } foreach ($connections['references'] as $reference) { echo "References: " . $reference['name'] . "\n"; } ``` -------------------------------- ### Retrieve Upcoming Releases Source: https://context7.com/tboothman/imdbphp/llms.txt Fetches upcoming movie releases for a specified country code. ```php upcomingReleases('US'); foreach ($releases as $release) { echo $release['title'] . " (" . $release['year'] . ")\n"; echo " IMDb ID: tt" . $release['imdbid'] . "\n"; echo " Release Date: " . $release['release_date']->format('Y-m-d') . "\n"; } ``` -------------------------------- ### Search for Films Source: https://github.com/tboothman/imdbphp/blob/master/README.md Use TitleSearch to find movies, optionally restricting by type, and iterate through the returned Title objects. ```php // include "bootstrap.php"; // Load the class in if you're not using an autoloader $search = 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() . ')'; } ``` -------------------------------- ### Retrieve Cast and Crew Information Source: https://context7.com/tboothman/imdbphp/llms.txt Fetch directors, writers, producers, actors, and other crew members for a specific movie title using its IMDb ID. The vendor autoloader must be included. ```php director(); foreach ($directors as $director) { echo "Director: " . $director['name'] . " (nm" . $director['imdb'] . ")\n"; // $director['role'] may contain additional info } // Get full cast list $cast = $title->cast(); foreach ($cast as $actor) { echo $actor['name'] . " as " . $actor['role'] . "\n"; echo " IMDb ID: nm" . $actor['imdb'] . "\n"; echo " Credited: " . ($actor['credited'] ? 'Yes' : 'No') . "\n"; // For TV shows if ($actor['role_episodes']) { echo " Episodes: " . $actor['role_episodes'] . " (" . $actor['role_start_year'] . "-" . $actor['role_end_year'] . ")\n"; } // Photo URLs if ($actor['thumb']) { echo " Thumbnail: " . $actor['thumb'] . "\n"; echo " Full Photo: " . $actor['photo'] . "\n"; } } // Get short cast list (from title page only - faster) $shortCast = $title->cast(true); // Get star actors only $stars = $title->actor_stars(); foreach ($stars as $star) { echo "Star: " . $star['name'] . " (nm" . $star['imdb'] . ")\n"; } // Get writers $writers = $title->writing(); foreach ($writers as $writer) { echo "Writer: " . $writer['name'] . " - " . $writer['role'] . "\n"; } // Get producers $producers = $title->producer(); foreach ($producers as $producer) { echo "Producer: " . $producer['name'] . " - " . $producer['role'] . "\n"; } // Get composers $composers = $title->composer(); // Get cinematographers $cinematographers = $title->cinematographer(); ``` -------------------------------- ### Retrieve Trivia, Goofs, and Quotes Source: https://context7.com/tboothman/imdbphp/llms.txt Retrieves miscellaneous metadata including trivia, goofs, quotes, and soundtracks. ```php trivia(); foreach ($trivia as $item) { echo "- $item\n"; } // Get goofs (limited to 5 per category) $goofs = $title->goofs(); foreach ($goofs as $goof) { echo "[" . $goof['type'] . "] " . $goof['content'] . "\n"; } // Get quotes $quotes = $title->quotes(); foreach ($quotes as $quote) { echo "$quote\n\n"; } // Get quotes split by character $quotesSplit = $title->quotes_split(); foreach ($quotesSplit as $quoteBlock) { foreach ($quoteBlock as $line) { echo $line['character']['name'] . ": " . $line['quote'] . "\n"; } echo "\n"; } // Get crazy credits $crazyCredits = $title->crazy_credits(); // Get keywords $keywords = $title->keywords(); // Limited keywords $allKeywords = $title->keywords_all(); // All keywords (up to 50) // Get soundtrack $soundtracks = $title->soundtrack(); foreach ($soundtracks as $track) { echo "Song: " . $track['soundtrack'] . "\n"; echo "Credits: " . $track['credits'] . "\n"; } ``` -------------------------------- ### Retrieve Awards and Nominations Source: https://context7.com/tboothman/imdbphp/llms.txt Fetches award data for a specific title using its IMDb ID. ```php awards(); foreach ($awards as $festivalName => $data) { echo "$festivalName:\n"; foreach ($data['entries'] as $entry) { $status = $entry['won'] ? 'Won' : 'Nominated'; echo " $status - " . $entry['award'] . "\n"; echo " Year: " . $entry['year'] . "\n"; echo " Category: " . $entry['category'] . "\n"; if (!empty($entry['people'])) { echo " People: " . implode(", ", $entry['people']) . "\n"; } } } ``` -------------------------------- ### Person Search API Source: https://context7.com/tboothman/imdbphp/llms.txt Searches for people by name and returns a list of matching results with basic context. ```APIDOC ## GET /Person/Search ### Description Allows searching for actors, directors, and other people by their name. ### Method GET ### Parameters #### Query Parameters - **name** (string) - Required - The name of the person to search for. ### Response #### Success Response (200) - **results** (array) - List of person objects containing name, IMDb ID, and search context (known for movie, year, role) ``` -------------------------------- ### Search for People Source: https://github.com/tboothman/imdbphp/blob/master/README.md Use PersonSearch to find individuals and access their name and IMDb ID. ```php // include "bootstrap.php"; // Load the class in if you're not using an autoloader $search = 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(); } ``` -------------------------------- ### Person Information API Source: https://context7.com/tboothman/imdbphp/llms.txt Retrieves detailed biographical information, birth/death data, trivia, and professional details for a specific person. ```APIDOC ## GET /Person ### Description Retrieves detailed information about actors, directors, and other people using their IMDb ID. ### Method GET ### Parameters #### Path Parameters - **id** (int) - Required - The IMDb ID of the person. ### Response #### Success Response (200) - **name** (string) - Person's name - **photo** (string) - Thumbnail URL - **born** (array) - Birth details (month, day, year, place) - **died** (array) - Death details (month, day, year, cause) - **birthname** (string) - Birth name - **nickname** (array) - List of nicknames - **height** (array) - Height in imperial and metric - **bio** (string) - Mini biography - **trivia** (array) - List of trivia items - **quotes** (array) - Personal quotes - **trademark** (array) - Signature characteristics - **spouse** (array) - List of spouse objects with children and notes - **salary** (array) - List of salary objects with movie details ``` -------------------------------- ### Search for Titles with IMDbPHP Source: https://context7.com/tboothman/imdbphp/llms.txt Utilize the TitleSearch class to find movies and TV shows on IMDb. You can filter results by type and limit the number of returned items. Ensure the Composer autoloader is included. ```php search('The Matrix'); // Search with type filter - only movies $results = $search->search('The Matrix', [ Imdb\ TitleSearch::MOVIE ]); // Search with multiple type filters $results = $search->search('Breaking Bad', [ Imdb\ TitleSearch::TV_SERIES, Imdb\ TitleSearch::TV_MINI_SERIES ]); // Limit number of results $results = $search->search('Star Wars', null, 10); // Available type constants: // TitleSearch::MOVIE, TitleSearch::TV_SERIES, TitleSearch::TV_EPISODE, // TitleSearch::TV_MINI_SERIES, TitleSearch::TV_MOVIE, TitleSearch::TV_SPECIAL, // TitleSearch::TV_SHORT, TitleSearch::GAME, TitleSearch::VIDEO, // TitleSearch::SHORT, TitleSearch::MUSIC_VIDEO, TitleSearch::PODCAST_SERIES // Results are Title objects with basic info pre-populated foreach ($results as $result) { echo $result->title() . ' (' . $result->year() . ') - ' . $result->movietype() . "\n"; // Access the IMDb ID echo "IMDb ID: " . $result->imdbid() . "\n"; } ``` -------------------------------- ### Resolve Redirected IMDb IDs Source: https://context7.com/tboothman/imdbphp/llms.txt Use the real_id() method on Title or Person objects to retrieve the canonical ID after potential redirects. ```php real_id(); echo "Original ID: 7393172\n"; echo "Actual ID: $realId\n"; // For Person $person = new \Imdb\Person(1234567); $realPersonId = $person->real_id(); ``` -------------------------------- ### Person Filmography API Source: https://context7.com/tboothman/imdbphp/llms.txt Retrieves a person's complete filmography categorized by their role (actor, director, producer, etc.). ```APIDOC ## GET /Person/Filmography ### Description Fetches a person's filmography organized by category such as acting, directing, or producing credits. ### Method GET ### Parameters #### Path Parameters - **id** (int) - Required - The IMDb ID of the person. ### Response #### Success Response (200) - **movies_all** (array) - Complete filmography - **movies_actor** (array) - Acting credits including character name and ID - **movies_director** (array) - Directing credits - **movies_producer** (array) - Producer credits - **movies_writer** (array) - Writer credits - **movies_soundtrack** (array) - Soundtrack credits - **movies_crew** (array) - Miscellaneous crew credits - **movies_thanx** (array) - Special thanks credits - **movies_self** (array) - Self-appearance credits - **movies_archive** (array) - Archive footage credits ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.