Simple integration with TMDB ( The Movie Database ) API to retrieve their data.
- ⚡⚡⚡ Laravel Tmdb
- Table of contents
- Setup
- Instructions
- Certifications
- Changes
- Collections
- Companies
- Configuration
- Credits
- Discover
- Genres
- Lists
- Movies
- Networks
- Trending
- People
- Reviews
- Search
- TV
- Get Details
- Get Aggregate Credits
- Get Alternative Names
- Get Changes
- Get Content Ratings
- Get Credits
- Get Episode Groups
- Get External IDs
- Get Images
- Get Keywords
- Get Recommendations
- Get Reviews
- Get Screened Theatrically
- Get Similar TV Shows
- Get Translations
- Get Videos
- Get latest
- Get TV Airing Today
- Get On The Air
- Get Popular
- Get Top Rated
- TV Seasons
- TV Episode
- Watch Providers
- Options
- Testing
- License
To install this package through composer run the following command in the terminal
composer require codebuglab/laravel-tmdbYou have to publish config file with this artisan command:
php artisan vendor:publish --provider="CodeBugLab\Tmdb\TmdbServiceProvider"- File
tmdb.phpwill be publish inconfigfolder after that. - Then you have to put your tmdb api key in your
envfile like thisTMDB_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. - If the returned data from the API should be in another language, set the TMDB_LANGUAGE key in your
env, eg. like this:TMDB_LANGUAGE=da.
- You can use tmdb api and get information your want, first take a quick look at official api page.
- For all next API requests you have to use Tmdb facade
use CodeBugLab\Tmdb\Facades\Tmdb;- Every request have it's own information link, you can know required parameters, returned array, different type of responses and optional query string and we take about this in options section
$tmdb = Tmdb::certifications()->movieCertifications()->get(); // return array- For more information.
$tmdb = Tmdb::certifications()->tvCertifications()->get(); // return array- For more information.
$tmdb = Tmdb::changes()->movieChangeList()->get(); // return array- For more information.
$tmdb = Tmdb::changes()->tvChangeList()->get(); // return array- For more information.
$tmdb = Tmdb::changes()->personChangeList()->get(); // return array- For more information.
$tmdb = Tmdb::collections()->details($collectionId)->get(); // return array- For more information.
$tmdb = Tmdb::collections()->images($collectionId)->get(); // return array- For more information.
$tmdb = Tmdb::collections()->transactions($collectionId)->get(); // return array- For more information.
$tmdb = Tmdb::companies()->details($collectionId)->get(); // return array- For more information.
$tmdb = Tmdb::companies()->alternativeNames($collectionId)->get(); // return array- For more information.
$tmdb = Tmdb::companies()->images($collectionId)->get(); // return array- For more information.
$tmdb = Tmdb::configuration()->apiConfiguration()->get(); // return array- For more information.
$tmdb = Tmdb::configuration()->countries()->get(); // return array- For more information.
$tmdb = Tmdb::configuration()->jobs()->get(); // return array- For more information.
$tmdb = Tmdb::configuration()->languages()->get(); // return array- For more information.
$tmdb = Tmdb::configuration()->primaryTranslations()->get(); // return array- For more information.
$tmdb = Tmdb::configuration()->timezones()->get(); // return array- For more information.
$tmdb = Tmdb::credits()->details($creditId)->get(); // return array- For more information.
$tmdb = Tmdb::discover()->movieDiscover()->get(); // return array- For more information.
$tmdb = Tmdb::discover()->tvDiscover()->get(); // return array- For more information.
$tmdb = Tmdb::genres()->movieList()->get(); // return array- For more information.
$tmdb = Tmdb::genres()->tvList()->get(); // return array- For more information.
$tmdb = Tmdb::lists()->details($listId)->get(); // return array- For more information.
$tmdb = Tmdb::lists()->itemStatus($listId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->details($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->alternativeTitles($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->changes($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->credits($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->externalIds($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->images($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->keywords($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->lists($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->recommendations($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->releaseDates($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->reviews($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->similar($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->translations($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->videos($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->watchProviders($movieId)->get(); // return array- For more information.
$tmdb = Tmdb::movies()->latest()->get(); // return array- For more information.
$tmdb = Tmdb::movies()->nowPlaying()->get(); // return array- For more information.
$tmdb = Tmdb::movies()->popular()->get(); // return array- For more information.
$tmdb = Tmdb::movies()->topRated()->get(); // return array- For more information.
$tmdb = Tmdb::movies()->upcoming()->get(); // return array- For more information.
$tmdb = Tmdb::networks()->details($networkId)->get(); // return array- For more information.
$tmdb = Tmdb::networks()->alternativeNames($networkId)->get(); // return array- For more information.
$tmdb = Tmdb::networks()->images($networkId)->get(); // return array- For more information.
$tmdb = Tmdb::trending()->trending($mediaType, $timeWindow)->get(); // return array- For more information.
$tmdb = Tmdb::people()->details($personId)->get(); // return array- For more information.
$tmdb = Tmdb::people()->changes($personId)->get(); // return array- For more information.
$tmdb = Tmdb::people()->movieCredits($personId)->get(); // return array- For more information.
$tmdb = Tmdb::people()->tvCredits($personId)->get(); // return array- For more information.
$tmdb = Tmdb::people()->combinedCredits($personId)->get(); // return array- For more information.
$tmdb = Tmdb::people()->externalIds($personId)->get(); // return array- For more information.
$tmdb = Tmdb::people()->images($personId)->get(); // return array- For more information.
$tmdb = Tmdb::people()->taggedImages($personId)->get(); // return array- For more information.
$tmdb = Tmdb::people()->translations($personId)->get(); // return array- For more information.
$tmdb = Tmdb::people()->latest()->get(); // return array- For more information.
$tmdb = Tmdb::people()->popular()->get(); // return array- For more information.
$tmdb = Tmdb::people()->popular()->get(); // return array- For more information.
$tmdb = Tmdb::reviews()->details($reviewId)->get(); // return array- For more information.
- Query option is required for this query and you put the search parameter instead of
$queryvariable. - For more Information
$tmdb = Tmdb::search()->companies()->query($query)->get(); // return array- For more information.
$tmdb = Tmdb::search()->collections()->query($query)->get(); // return array- For more information.
$tmdb = Tmdb::search()->keywords()->query($query)->get(); // return array- For more information.
$tmdb = Tmdb::search()->movies()->query($query)->get(); // return array- For more information.
$tmdb = Tmdb::search()->multi()->query($query)->get(); // return array- For more information.
$tmdb = Tmdb::search()->people()->query($query)->get(); // return array- For more information.
$tmdb = Tmdb::search()->tvShows()->query($query)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->details($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->aggregateCredits($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->alternativeTitles($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->changes($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->contentRatings($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->credits($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->episodeGroups($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->externalIds($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->images($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->keywords($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->recommendations($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->reviews($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->screenedTheatrically($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->similar($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->translations($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->watchProviders($tvId)->get(); // return array- For more information.
$tmdb = Tmdb::tv()->latest()->get(); // return array- For more information.
$tmdb = Tmdb::tv()->airingToday()->get(); // return array- For more information.
$tmdb = Tmdb::tv()->onTheAir()->get(); // return array- For more information.
$tmdb = Tmdb::tv()->popular()->get(); // return array- For more information.
$tmdb = Tmdb::tv()->topRated()->get(); // return array- For more information.
$tmdb = Tmdb::tvSeasons()->details($tvId, $seasonNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvSeasons()->aggregateCredits($tvId, $seasonNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvSeasons()->changes($tvId, $seasonNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvSeasons()->credits($tvId, $seasonNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvSeasons()->externalIds($tvId, $seasonNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvSeasons()->images($tvId, $seasonNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvSeasons()->transactions($tvId, $seasonNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvSeasons()->videos($tvId, $seasonNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvEpisodes()->details($tvId, $seasonNumber, $episodeNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvEpisodes()->changes($tvId, $seasonNumber, $episodeNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvEpisodes()->credits($episodeNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvEpisodes()->externalIds($tvId, $seasonNumber, $episodeNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvEpisodes()->images($tvId, $seasonNumber, $episodeNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvEpisodes()->transactions($tvId, $seasonNumber, $episodeNumber)->get(); // return array- For more information.
$tmdb = Tmdb::tvEpisodes()->videos($tvId, $seasonNumber, $episodeNumber)->get(); // return array- For more information.
$tmdb = Tmdb::watchProviders()->availableRegions()->get(); // return array- For more information.
$tmdb = Tmdb::watchProviders()->movieProviders()->get(); // return array- For more information.
$tmdb = Tmdb::watchProviders()->tvProviders()->get(); // return array- For more information.
- tmdb api provides some options in some requests to provide more flexibility during request, and we add some of them here.
- You will find supported options with explanation of every option we have in Query String section in every information page Like the one here and as you can see languages, page, and region supported by tmdb.

- We don't support all options yet but will add more by time.
- You have to read the of tmdb carefully to avoid using unsupported option.
- Here is some options which supported in this packages with explanation.
- If you want to get most popular movies from tmdb api you will get only 20 records will you can get about 800 record so instead or returning the whole records they give you only first 20 records and you can get the next 20 by using page option.
- So instead of using the request like that
$tmdb = Tmdb::movies()->popular()->get(); // return arrayand that will return the first page, you can specify the page you wanted to get for example if you want to get second page you will write the request like that.
$tmdb = Tmdb::movies()->popular()->page(2)->get(); // return array- The option equivalent of query parameter append_to_response, for more Information
- This option can take multiple parameters like videos, posters and casts.
- For example you can append more information about movie casts buy using this query.
$tmdb = Tmdb::movies()->details($movieId)->appendToResponse(['casts'])->get(); // return array- This option used when you want to use tmdb search.
- For example if you want to search for tv show you have to get it by this way.
$tmdb = Tmdb::search()->tvShows()->query($query)->get();where $query is a string you want to search for and it will be a tv show in this example.
To run test use this command vendor/bin/phpunit
This package is a free software distributed under the terms of the MIT license.
