Download the PHP package vfalies/tmdb without Composer
On this page you can find all versions of the php package vfalies/tmdb. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package tmdb
Short Description A PHP Wrapper for The Internet Movie Database API
License MIT
Homepage https://vfac.fr/projects/tmdb
Informations about the package tmdb
Tmdb - PHP Wrapper for The Movie Database API V3
Tmdb is a PHP wrapper for The Movie Database API V3.
Table of contents
- Features
- Installation
- Basic usage
- Usage
- Getting a TMDB instance
- Movie
- TV Show
- Collection
- People
- Company
- Find by an external ID
- Authentication
- Media Helper
- Unit tests
- About
Features
Features actualy supported :
- Search
- Movie
- TV Show
- Collection
- Company
- Getting informations
- Movie
- TV Show
- Collection
- Company
- Genres
- TV Network
- Account
- Authentification
- Movies / TV Shows rating
- Movies / TV Shows favorites
- Movies / TV Shows watchlist
- Media
- Genres
- Jobs
- Find
- IMDb
- TheTVDb
- TVRage
Installation
Requirements
- Tmdb works with PHP 7.1 and higher
- TheMovieDatabase API key
Composer
Install the lastest version with
Basic Usage
Usage
Getting a TMDB instance
TMDB
is the main class of the library.
It has two dependencies :
- a API key from The Movie DataBase website
- a
Psr\Log\LoggerInterface
instance to write logs
Using the Factory
It is the easiest way to load TMDB
In a Slim application
If your application is built with Slim, you can add TMDB in your dependencies and inject Slim's Monolog instance into it.
Just add this in dependencies.php
In this example, API key is declared in settings.php
Do it yourself
Convenient if you need too inject your own dependencies. In the example below, we inject Monolog configured to write logs on standards output.
Movie
Search a movie
The search returns Generator
object of Result\Movie
object.
Get a movie
The getter returns a Movie
object.
TV Show
Search a TV Show
The search returns Generator
object of Result\TVShow
object.
Get a TV Show
The getter returns a TVShow
object.
Get a TV Season
The getter returns a TVSeason
object.
Get a TV Episode
The getter returns a TVEpisode
object.
Collection
Search a Collection
The search returns Generator
object of Result\Collection
object.
Get a Collection
The getter returns a Collection
object.
People
Search a People
The search returns Generator
object of Result\People
object.
Get a People
The getter returns a People
object.
Company
Search a company
The search returns Generator
object of Result\Company
object.
Get a Company
The getter returns a Company
object.
Find by an external ID
The find method makes it easy to search for objects in TMDb database by an external id.
Each sources has his proper methods: imdb
, tvdb
, tvrage
, facebook
, twitter
, instagram
.
The find returns a Result\Find
object. Each types of objects can be getted by a specific method. The returns is a Generator
object of Result\[expected type]
object.
Object types | Methods | Generator of |
---|---|---|
movies | getMovies() | Result\Movie |
peoples | getPeoples() | Result\People |
TV shows | getTVShows() | Result\TVShow |
TV episodes | getTVEpisodes() | Result\TVEpisode |
TV Seasons | getTVSeasons() | Result\TVSeason |
The supported external sources for each object are as follows.
Movies | TV Shows | TV Seasons | TV Episodes | People | |
---|---|---|---|---|---|
IMDb ID | ✓ | ✓ | ✕ | ✓ | ✓ |
TVDb ID | ✓ | ✓ | ✓ | ✕ | |
Freebase MID | not implemented | ||||
Freebase ID | not implemented | ||||
TVRage | ✕ | ✓ | ✓ | ✓ | ✓ |
✓ | ✓ | ✕ | ✕ | ✓ | |
✓ | ✓ | ✕ | ✕ | ✓ | |
✓ | ✓ | ✕ | ✕ | ✓ |
Authentication
The connection to your account is in 3 steps:
- Getting a request token
- Connection to TMDb website
- Create a session
Getting a request token
Connect to TMDb website
This call redirect the page to TMDb website login page for identification and authorisations. By default, after the connection, the user stay on TMDb website. To redirect to your website after the connection, use the following code:
Create a session
To use all account methods, we must use a valid session.
Media Helper
All media informations delivered by the library are relative pathfile.
To get a valid media URL, use the Media
class to generate the URL and check the media size
The following type of media are supported :
- Backdrop
- Poster
- Logo
- Profile
- Still
Unit Testing
You can run the unit test suites using the following command in the library's source directory:
About
Submitting bugs and feature requests
Bugs and feature request are tracked on GitHub
Author
Vincent Faliès - [email protected]
License
VfacTmdb is licensed under the MIT License - see the LICENSE
file for details