codebuglab / laravel-tmdb
Simple integration with TMDB ( The Movie Database ) API to retrieve their data.
Installs: 3 236
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: >=7.0
- illuminate/support: >=6.0.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-12-22 14:48:32 UTC
README
Simple integration with TMDB ( The Movie Database ) API to retrieve their data.
Table of contents
- ⚡⚡⚡ 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
Setup
Installation
To install this package through composer run the following command in the terminal
composer require codebuglab/laravel-tmdb
Publish
You have to publish config file with this artisan command:
php artisan vendor:publish --provider="CodeBugLab\Tmdb\TmdbServiceProvider"
- File
tmdb.php
will be publish inconfig
folder after that. - Then you have to put your tmdb api key in your
env
file 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
.
Instructions
- 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
Certifications
Get Movie Certifications
$tmdb = Tmdb::certifications()->movieCertifications()->get(); // return array
- For more information.
Get TV Certifications
$tmdb = Tmdb::certifications()->tvCertifications()->get(); // return array
- For more information.
Changes
Get Movie Change List
$tmdb = Tmdb::changes()->movieChangeList()->get(); // return array
- For more information.
Get TV Change List
$tmdb = Tmdb::changes()->tvChangeList()->get(); // return array
- For more information.
Get Person Change List
$tmdb = Tmdb::changes()->personChangeList()->get(); // return array
- For more information.
Collections
Get Details
$tmdb = Tmdb::collections()->details($collectionId)->get(); // return array
- For more information.
Get Images
$tmdb = Tmdb::collections()->images($collectionId)->get(); // return array
- For more information.
Get Transactions
$tmdb = Tmdb::collections()->transactions($collectionId)->get(); // return array
- For more information.
Companies
Get Details
$tmdb = Tmdb::companies()->details($collectionId)->get(); // return array
- For more information.
Get Alternative Names
$tmdb = Tmdb::companies()->alternativeNames($collectionId)->get(); // return array
- For more information.
Get Images
$tmdb = Tmdb::companies()->images($collectionId)->get(); // return array
- For more information.
Configuration
Get API Configuration
$tmdb = Tmdb::configuration()->apiConfiguration()->get(); // return array
- For more information.
Get Countries
$tmdb = Tmdb::configuration()->countries()->get(); // return array
- For more information.
Get Jobs
$tmdb = Tmdb::configuration()->jobs()->get(); // return array
- For more information.
Get Languages
$tmdb = Tmdb::configuration()->languages()->get(); // return array
- For more information.
Get Primary Translations
$tmdb = Tmdb::configuration()->primaryTranslations()->get(); // return array
- For more information.
Get Timezones
$tmdb = Tmdb::configuration()->timezones()->get(); // return array
- For more information.
Credits
Get Details
$tmdb = Tmdb::credits()->details($creditId)->get(); // return array
- For more information.
Discover
Movie Discover
$tmdb = Tmdb::discover()->movieDiscover()->get(); // return array
- For more information.
TV Discover
$tmdb = Tmdb::discover()->tvDiscover()->get(); // return array
- For more information.
Genres
Get Movie List
$tmdb = Tmdb::genres()->movieList()->get(); // return array
- For more information.
Get TV List
$tmdb = Tmdb::genres()->tvList()->get(); // return array
- For more information.
Lists
Get Details
$tmdb = Tmdb::lists()->details($listId)->get(); // return array
- For more information.
Check Item Status
$tmdb = Tmdb::lists()->itemStatus($listId)->get(); // return array
- For more information.
Movies
Get Details
$tmdb = Tmdb::movies()->details($movieId)->get(); // return array
- For more information.
Get Alternative Titles
$tmdb = Tmdb::movies()->alternativeTitles($movieId)->get(); // return array
- For more information.
Get Changes
$tmdb = Tmdb::movies()->changes($movieId)->get(); // return array
- For more information.
Get Credits
$tmdb = Tmdb::movies()->credits($movieId)->get(); // return array
- For more information.
Get External IDs
$tmdb = Tmdb::movies()->externalIds($movieId)->get(); // return array
- For more information.
Get Images
$tmdb = Tmdb::movies()->images($movieId)->get(); // return array
- For more information.
Get Keywords
$tmdb = Tmdb::movies()->keywords($movieId)->get(); // return array
- For more information.
Get Lists
$tmdb = Tmdb::movies()->lists($movieId)->get(); // return array
- For more information.
Get Recommendations
$tmdb = Tmdb::movies()->recommendations($movieId)->get(); // return array
- For more information.
Get Release Dates
$tmdb = Tmdb::movies()->releaseDates($movieId)->get(); // return array
- For more information.
Get Reviews
$tmdb = Tmdb::movies()->reviews($movieId)->get(); // return array
- For more information.
Get Similar Movies
$tmdb = Tmdb::movies()->similar($movieId)->get(); // return array
- For more information.
Get Translations
$tmdb = Tmdb::movies()->translations($movieId)->get(); // return array
- For more information.
Get Videos
$tmdb = Tmdb::movies()->videos($movieId)->get(); // return array
- For more information.
Get Watch Provider
$tmdb = Tmdb::movies()->watchProviders($movieId)->get(); // return array
- For more information.
Get Latest
$tmdb = Tmdb::movies()->latest()->get(); // return array
- For more information.
Get Now Playing
$tmdb = Tmdb::movies()->nowPlaying()->get(); // return array
- For more information.
Get Popular
$tmdb = Tmdb::movies()->popular()->get(); // return array
- For more information.
Get Top Rated
$tmdb = Tmdb::movies()->topRated()->get(); // return array
- For more information.
Get Upcoming
$tmdb = Tmdb::movies()->upcoming()->get(); // return array
- For more information.
Networks
Get Details
$tmdb = Tmdb::networks()->details($networkId)->get(); // return array
- For more information.
Get Alternative Names
$tmdb = Tmdb::networks()->alternativeNames($networkId)->get(); // return array
- For more information.
Get Images
$tmdb = Tmdb::networks()->images($networkId)->get(); // return array
- For more information.
Trending
Get Trending
$tmdb = Tmdb::trending()->trending($mediaType, $timeWindow)->get(); // return array
- For more information.
People
Get Details
$tmdb = Tmdb::people()->details($personId)->get(); // return array
- For more information.
Get Changes
$tmdb = Tmdb::people()->changes($personId)->get(); // return array
- For more information.
Get Movie Credits
$tmdb = Tmdb::people()->movieCredits($personId)->get(); // return array
- For more information.
Get TV Credits
$tmdb = Tmdb::people()->tvCredits($personId)->get(); // return array
- For more information.
Get Combined Credits
$tmdb = Tmdb::people()->combinedCredits($personId)->get(); // return array
- For more information.
Get External IDs
$tmdb = Tmdb::people()->externalIds($personId)->get(); // return array
- For more information.
Get Images
$tmdb = Tmdb::people()->images($personId)->get(); // return array
- For more information.
Get Tagged Images
$tmdb = Tmdb::people()->taggedImages($personId)->get(); // return array
- For more information.
Get Translations
$tmdb = Tmdb::people()->translations($personId)->get(); // return array
- For more information.
Get Latest
$tmdb = Tmdb::people()->latest()->get(); // return array
- For more information.
Get Popular
$tmdb = Tmdb::people()->popular()->get(); // return array
- For more information.
Get Watch Providers
$tmdb = Tmdb::people()->popular()->get(); // return array
- For more information.
Reviews
Get Details
$tmdb = Tmdb::reviews()->details($reviewId)->get(); // return array
- For more information.
Search
- Query option is required for this query and you put the search parameter instead of
$query
variable. - For more Information
Search Companies
$tmdb = Tmdb::search()->companies()->query($query)->get(); // return array
- For more information.
Search Collections
$tmdb = Tmdb::search()->collections()->query($query)->get(); // return array
- For more information.
Search Keywords
$tmdb = Tmdb::search()->keywords()->query($query)->get(); // return array
- For more information.
Search Movies
$tmdb = Tmdb::search()->movies()->query($query)->get(); // return array
- For more information.
multi Search
$tmdb = Tmdb::search()->multi()->query($query)->get(); // return array
- For more information.
Search People
$tmdb = Tmdb::search()->people()->query($query)->get(); // return array
- For more information.
Search TV Show
$tmdb = Tmdb::search()->tvShows()->query($query)->get(); // return array
- For more information.
TV
Get Details
$tmdb = Tmdb::tv()->details($tvId)->get(); // return array
- For more information.
Get Aggregate Credits
$tmdb = Tmdb::tv()->aggregateCredits($tvId)->get(); // return array
- For more information.
Get Alternative Names
$tmdb = Tmdb::tv()->alternativeTitles($tvId)->get(); // return array
- For more information.
Get Changes
$tmdb = Tmdb::tv()->changes($tvId)->get(); // return array
- For more information.
Get Content Ratings
$tmdb = Tmdb::tv()->contentRatings($tvId)->get(); // return array
- For more information.
Get Credits
$tmdb = Tmdb::tv()->credits($tvId)->get(); // return array
- For more information.
Get Episode Groups
$tmdb = Tmdb::tv()->episodeGroups($tvId)->get(); // return array
- For more information.
Get External IDs
$tmdb = Tmdb::tv()->externalIds($tvId)->get(); // return array
- For more information.
Get Images
$tmdb = Tmdb::tv()->images($tvId)->get(); // return array
- For more information.
Get Keywords
$tmdb = Tmdb::tv()->keywords($tvId)->get(); // return array
- For more information.
Get Recommendations
$tmdb = Tmdb::tv()->recommendations($tvId)->get(); // return array
- For more information.
Get Reviews
$tmdb = Tmdb::tv()->reviews($tvId)->get(); // return array
- For more information.
Get Screened Theatrically
$tmdb = Tmdb::tv()->screenedTheatrically($tvId)->get(); // return array
- For more information.
Get Similar TV Shows
$tmdb = Tmdb::tv()->similar($tvId)->get(); // return array
- For more information.
Get Translations
$tmdb = Tmdb::tv()->translations($tvId)->get(); // return array
- For more information.
Get Videos
$tmdb = Tmdb::tv()->watchProviders($tvId)->get(); // return array
- For more information.
Get latest
$tmdb = Tmdb::tv()->latest()->get(); // return array
- For more information.
Get TV Airing Today
$tmdb = Tmdb::tv()->airingToday()->get(); // return array
- For more information.
Get On The Air
$tmdb = Tmdb::tv()->onTheAir()->get(); // return array
- For more information.
Get Popular
$tmdb = Tmdb::tv()->popular()->get(); // return array
- For more information.
Get Top Rated
$tmdb = Tmdb::tv()->topRated()->get(); // return array
- For more information.
TV Seasons
Get Details
$tmdb = Tmdb::tvSeasons()->details($tvId, $seasonNumber)->get(); // return array
- For more information.
Get Aggregate Credits
$tmdb = Tmdb::tvSeasons()->aggregateCredits($tvId, $seasonNumber)->get(); // return array
- For more information.
Get Changes
$tmdb = Tmdb::tvSeasons()->changes($tvId, $seasonNumber)->get(); // return array
- For more information.
Get Credits
$tmdb = Tmdb::tvSeasons()->credits($tvId, $seasonNumber)->get(); // return array
- For more information.
Get External IDs
$tmdb = Tmdb::tvSeasons()->externalIds($tvId, $seasonNumber)->get(); // return array
- For more information.
Get Images
$tmdb = Tmdb::tvSeasons()->images($tvId, $seasonNumber)->get(); // return array
- For more information.
Get Transactions
$tmdb = Tmdb::tvSeasons()->transactions($tvId, $seasonNumber)->get(); // return array
- For more information.
Get Videos
$tmdb = Tmdb::tvSeasons()->videos($tvId, $seasonNumber)->get(); // return array
- For more information.
TV Episode
Get Details
$tmdb = Tmdb::tvEpisodes()->details($tvId, $seasonNumber, $episodeNumber)->get(); // return array
- For more information.
Get Changes
$tmdb = Tmdb::tvEpisodes()->changes($tvId, $seasonNumber, $episodeNumber)->get(); // return array
- For more information.
Get Credits
$tmdb = Tmdb::tvEpisodes()->credits($episodeNumber)->get(); // return array
- For more information.
Get External IDs
$tmdb = Tmdb::tvEpisodes()->externalIds($tvId, $seasonNumber, $episodeNumber)->get(); // return array
- For more information.
Get Images
$tmdb = Tmdb::tvEpisodes()->images($tvId, $seasonNumber, $episodeNumber)->get(); // return array
- For more information.
Get Transactions
$tmdb = Tmdb::tvEpisodes()->transactions($tvId, $seasonNumber, $episodeNumber)->get(); // return array
- For more information.
Get Videos
$tmdb = Tmdb::tvEpisodes()->videos($tvId, $seasonNumber, $episodeNumber)->get(); // return array
- For more information.
Watch Providers
Get Available Regions
$tmdb = Tmdb::watchProviders()->availableRegions()->get(); // return array
- For more information.
Get Movie Providers
$tmdb = Tmdb::watchProviders()->movieProviders()->get(); // return array
- For more information.
Get TV Providers
$tmdb = Tmdb::watchProviders()->tvProviders()->get(); // return array
- For more information.
Options
- 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.
Page
- 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 array
and 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
Append To Response
- 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
Query
- 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.
Testing
To run test use this command vendor/bin/phpunit
License
This package is a free software distributed under the terms of the MIT license.