codebuglab/laravel-tmdb

Simple integration with TMDB ( The Movie Database ) API to retrieve their data.

v0.0.5-beta 2022-08-22 10:01 UTC

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.

Laravel media removable

Table of contents

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 in config folder after that.
  • Then you have to put your tmdb api key in your env file like this TMDB_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

Get TV Certifications

$tmdb = Tmdb::certifications()->tvCertifications()->get(); // return array

Changes

Get Movie Change List

$tmdb = Tmdb::changes()->movieChangeList()->get(); // return array

Get TV Change List

$tmdb = Tmdb::changes()->tvChangeList()->get(); // return array

Get Person Change List

$tmdb = Tmdb::changes()->personChangeList()->get(); // return array

Collections

Get Details

$tmdb = Tmdb::collections()->details($collectionId)->get(); // return array

Get Images

$tmdb = Tmdb::collections()->images($collectionId)->get(); // return array

Get Transactions

$tmdb = Tmdb::collections()->transactions($collectionId)->get(); // return array

Companies

Get Details

$tmdb = Tmdb::companies()->details($collectionId)->get(); // return array

Get Alternative Names

$tmdb = Tmdb::companies()->alternativeNames($collectionId)->get(); // return array

Get Images

$tmdb = Tmdb::companies()->images($collectionId)->get(); // return array

Configuration

Get API Configuration

$tmdb = Tmdb::configuration()->apiConfiguration()->get(); // return array

Get Countries

$tmdb = Tmdb::configuration()->countries()->get(); // return array

Get Jobs

$tmdb = Tmdb::configuration()->jobs()->get(); // return array

Get Languages

$tmdb = Tmdb::configuration()->languages()->get(); // return array

Get Primary Translations

$tmdb = Tmdb::configuration()->primaryTranslations()->get(); // return array

Get Timezones

$tmdb = Tmdb::configuration()->timezones()->get(); // return array

Credits

Get Details

$tmdb = Tmdb::credits()->details($creditId)->get(); // return array

Discover

Movie Discover

$tmdb = Tmdb::discover()->movieDiscover()->get(); // return array

TV Discover

$tmdb = Tmdb::discover()->tvDiscover()->get(); // return array

Genres

Get Movie List

$tmdb = Tmdb::genres()->movieList()->get(); // return array

Get TV List

$tmdb = Tmdb::genres()->tvList()->get(); // return array

Lists

Get Details

$tmdb = Tmdb::lists()->details($listId)->get(); // return array

Check Item Status

$tmdb = Tmdb::lists()->itemStatus($listId)->get(); // return array

Movies

Get Details

$tmdb = Tmdb::movies()->details($movieId)->get(); // return array

Get Alternative Titles

$tmdb = Tmdb::movies()->alternativeTitles($movieId)->get(); // return array

Get Changes

$tmdb = Tmdb::movies()->changes($movieId)->get(); // return array

Get Credits

$tmdb = Tmdb::movies()->credits($movieId)->get(); // return array

Get External IDs

$tmdb = Tmdb::movies()->externalIds($movieId)->get(); // return array

Get Images

$tmdb = Tmdb::movies()->images($movieId)->get(); // return array

Get Keywords

$tmdb = Tmdb::movies()->keywords($movieId)->get(); // return array

Get Lists

$tmdb = Tmdb::movies()->lists($movieId)->get(); // return array

Get Recommendations

$tmdb = Tmdb::movies()->recommendations($movieId)->get(); // return array

Get Release Dates

$tmdb = Tmdb::movies()->releaseDates($movieId)->get(); // return array

Get Reviews

$tmdb = Tmdb::movies()->reviews($movieId)->get(); // return array

Get Similar Movies

$tmdb = Tmdb::movies()->similar($movieId)->get(); // return array

Get Translations

$tmdb = Tmdb::movies()->translations($movieId)->get(); // return array

Get Videos

$tmdb = Tmdb::movies()->videos($movieId)->get(); // return array

Get Watch Provider

$tmdb = Tmdb::movies()->watchProviders($movieId)->get(); // return array

Get Latest

$tmdb = Tmdb::movies()->latest()->get(); // return array

Get Now Playing

$tmdb = Tmdb::movies()->nowPlaying()->get(); // return array

Get Popular

$tmdb = Tmdb::movies()->popular()->get(); // return array

Get Top Rated

$tmdb = Tmdb::movies()->topRated()->get(); // return array

Get Upcoming

$tmdb = Tmdb::movies()->upcoming()->get(); // return array

Networks

Get Details

$tmdb = Tmdb::networks()->details($networkId)->get(); // return array

Get Alternative Names

$tmdb = Tmdb::networks()->alternativeNames($networkId)->get(); // return array

Get Images

$tmdb = Tmdb::networks()->images($networkId)->get(); // return array

Trending

Get Trending

$tmdb = Tmdb::trending()->trending($mediaType, $timeWindow)->get(); // return array

People

Get Details

$tmdb = Tmdb::people()->details($personId)->get(); // return array

Get Changes

$tmdb = Tmdb::people()->changes($personId)->get(); // return array

Get Movie Credits

$tmdb = Tmdb::people()->movieCredits($personId)->get(); // return array

Get TV Credits

$tmdb = Tmdb::people()->tvCredits($personId)->get(); // return array

Get Combined Credits

$tmdb = Tmdb::people()->combinedCredits($personId)->get(); // return array

Get External IDs

$tmdb = Tmdb::people()->externalIds($personId)->get(); // return array

Get Images

$tmdb = Tmdb::people()->images($personId)->get(); // return array

Get Tagged Images

$tmdb = Tmdb::people()->taggedImages($personId)->get(); // return array

Get Translations

$tmdb = Tmdb::people()->translations($personId)->get(); // return array

Get Latest

$tmdb = Tmdb::people()->latest()->get(); // return array

Get Popular

$tmdb = Tmdb::people()->popular()->get(); // return array

Get Watch Providers

$tmdb = Tmdb::people()->popular()->get(); // return array

Reviews

Get Details

$tmdb = Tmdb::reviews()->details($reviewId)->get(); // return array

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

Search Collections

$tmdb = Tmdb::search()->collections()->query($query)->get(); // return array

Search Keywords

$tmdb = Tmdb::search()->keywords()->query($query)->get(); // return array

Search Movies

$tmdb = Tmdb::search()->movies()->query($query)->get(); // return array

multi Search

$tmdb = Tmdb::search()->multi()->query($query)->get(); // return array

Search People

$tmdb = Tmdb::search()->people()->query($query)->get(); // return array

Search TV Show

$tmdb = Tmdb::search()->tvShows()->query($query)->get(); // return array

TV

Get Details

$tmdb = Tmdb::tv()->details($tvId)->get(); // return array

Get Aggregate Credits

$tmdb = Tmdb::tv()->aggregateCredits($tvId)->get(); // return array

Get Alternative Names

$tmdb = Tmdb::tv()->alternativeTitles($tvId)->get(); // return array

Get Changes

$tmdb = Tmdb::tv()->changes($tvId)->get(); // return array

Get Content Ratings

$tmdb = Tmdb::tv()->contentRatings($tvId)->get(); // return array

Get Credits

$tmdb = Tmdb::tv()->credits($tvId)->get(); // return array

Get Episode Groups

$tmdb = Tmdb::tv()->episodeGroups($tvId)->get(); // return array

Get External IDs

$tmdb = Tmdb::tv()->externalIds($tvId)->get(); // return array

Get Images

$tmdb = Tmdb::tv()->images($tvId)->get(); // return array

Get Keywords

$tmdb = Tmdb::tv()->keywords($tvId)->get(); // return array

Get Recommendations

$tmdb = Tmdb::tv()->recommendations($tvId)->get(); // return array

Get Reviews

$tmdb = Tmdb::tv()->reviews($tvId)->get(); // return array

Get Screened Theatrically

$tmdb = Tmdb::tv()->screenedTheatrically($tvId)->get(); // return array

Get Similar TV Shows

$tmdb = Tmdb::tv()->similar($tvId)->get(); // return array

Get Translations

$tmdb = Tmdb::tv()->translations($tvId)->get(); // return array

Get Videos

$tmdb = Tmdb::tv()->watchProviders($tvId)->get(); // return array

Get latest

$tmdb = Tmdb::tv()->latest()->get(); // return array

Get TV Airing Today

$tmdb = Tmdb::tv()->airingToday()->get(); // return array

Get On The Air

$tmdb = Tmdb::tv()->onTheAir()->get(); // return array

Get Popular

$tmdb = Tmdb::tv()->popular()->get(); // return array

Get Top Rated

$tmdb = Tmdb::tv()->topRated()->get(); // return array

TV Seasons

Get Details

$tmdb = Tmdb::tvSeasons()->details($tvId, $seasonNumber)->get(); // return array

Get Aggregate Credits

$tmdb = Tmdb::tvSeasons()->aggregateCredits($tvId, $seasonNumber)->get(); // return array

Get Changes

$tmdb = Tmdb::tvSeasons()->changes($tvId, $seasonNumber)->get(); // return array

Get Credits

$tmdb = Tmdb::tvSeasons()->credits($tvId, $seasonNumber)->get(); // return array

Get External IDs

$tmdb = Tmdb::tvSeasons()->externalIds($tvId, $seasonNumber)->get(); // return array

Get Images

$tmdb = Tmdb::tvSeasons()->images($tvId, $seasonNumber)->get(); // return array

Get Transactions

$tmdb = Tmdb::tvSeasons()->transactions($tvId, $seasonNumber)->get(); // return array

Get Videos

$tmdb = Tmdb::tvSeasons()->videos($tvId, $seasonNumber)->get(); // return array

TV Episode

Get Details

$tmdb = Tmdb::tvEpisodes()->details($tvId, $seasonNumber, $episodeNumber)->get(); // return array

Get Changes

$tmdb = Tmdb::tvEpisodes()->changes($tvId, $seasonNumber, $episodeNumber)->get(); // return array

Get Credits

$tmdb = Tmdb::tvEpisodes()->credits($episodeNumber)->get(); // return array

Get External IDs

$tmdb = Tmdb::tvEpisodes()->externalIds($tvId, $seasonNumber, $episodeNumber)->get(); // return array

Get Images

$tmdb = Tmdb::tvEpisodes()->images($tvId, $seasonNumber, $episodeNumber)->get(); // return array

Get Transactions

$tmdb = Tmdb::tvEpisodes()->transactions($tvId, $seasonNumber, $episodeNumber)->get(); // return array

Get Videos

$tmdb = Tmdb::tvEpisodes()->videos($tvId, $seasonNumber, $episodeNumber)->get(); // return array

Watch Providers

Get Available Regions

$tmdb = Tmdb::watchProviders()->availableRegions()->get(); // return array

Get Movie Providers

$tmdb = Tmdb::watchProviders()->movieProviders()->get(); // return array

Get TV Providers

$tmdb = Tmdb::watchProviders()->tvProviders()->get(); // return array

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. options
  • 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.