bogdanfinn / tmdb-bundle
Symfony Bundle for accessing https://www.themoviedb.org API
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~6.0
- symfony/config: >=2.3,<4
- symfony/dependency-injection: >=2.3,<4
- symfony/event-dispatcher: >=2.3,<4
- symfony/http-kernel: >=2.3,<4
- twig/twig: ~1.11|~2.0
Requires (Dev)
- phpunit/phpunit: ^4.8
- symfony/framework-bundle: >=2.3,<4
This package is not auto-updated.
Last update: 2024-04-28 00:17:44 UTC
README
A symfony bundle for accessing the https://www.themoviedb.org/ Api
The Bundle is currently work in progress!
Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require bogdanfinn/tmdb-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle / Configuration
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new bogdanfinn\tmdbBundle\tmdbBundle(),
);
// ...
}
// ...
}
Add to your app/config/config.yml
the following:
tmdb:
api_key: "API_KEY_HERE"
use_models: true
If use set use_models
to true
the Services return Model instances of Movies, TvShows, Episodes and Seasons located under bogdanfinn/tmdbBundle/Model
. If you set use_models
to false
the services return JSON objects.
Step 3: Usage
Get the TvShowClient in your Controller
$tvShowClient = $this->get('tmdb_tvshow_client');
Get the MovieClient in your Controller
$movieClient = $this->get('tmdb_movie_client');
Get the EpisodeClient in your Controller
$episodeClient = $this->get('tmdb_episode_client');
Get the SeasonClient in your Controller
$seasonClient = $this->get('tmdb_season_client');
Get the SearchClient in your Controller
$searchClient = $this->get('tmdb_search_client');
Methods
Get Information for another language
You can set the language in the ClientMethod as second parameter. The default language is always en
.
$response = $client->method($firstParameter, 'de');
$response = $client->method($firstParameter, 'de');
TvShowClient
$tvShowsSearchResults = $tvShowClient->searchTvShow('The Walking Dead');
$tvShow = $tvShowClient->getTvShow(1402);
$todayAiringShows = $tvShowClient->getAiringToday();
$onTheAirShows = $tvShowClient->getOnTheAir();
$season = $tvShowClient->getSeason(1402, 1);
$episode = $tvShowClient->getEpisode(1402, 1, 1);
$tvShowRecommendations = $tvShowClient->getRecommendations(1402);
$similarTvShows = $tvShowClient->getSimilarTvShows(1402);
SeasonClient
//Parameter: tvShowId, seasonNumber
$season = $seasonClient->getSeason(1402, 1);
EpisodeClient
//Parameter: tvShowId, seasonNumber, episodeNumber
$episode = $episodeClient->getEpisode(1402, 1, 1);
MovieClient
$movieRecommendations = $movieClient->getRecommendations(13);
$movie = $movieClient->getMovie(13);
$movieSearchResults = $movieClient->searchMovie('Forrest Gump');
$similarMovies = $movieClient->getSimilarMovies(13);
$upcomingMovies = $movieClient->getUpcomingMovies();
SearchClient
$movieSearchResults = $searchClient->searchMovie('Forrest Gump');
$tvShowSearchResults = $searchClient->searchTvShow('The Walking Dead');
//Movies, TvShows and Persons
$multiSearchResults = $searchClient->multiSearch('Wesley');