public function show($id) { $token = new \Tmdb\ApiToken('API_KEY'); $client = new \Tmdb\Client($token, ['secure' => false]); $person = $client->getPeopleApi()->getPerson($id, array('language' => 'fr')); $credits = $client->getPeopleApi()->getMovieCredits($id); return view('pages/director', ['person' => $person, 'credits' => $credits]); }
public function latest() { $token = new \Tmdb\ApiToken('API_KEY'); $client = new \Tmdb\Client($token, ['secure' => false]); $popularity = $client->getDiscoverApi()->discoverMovies(['page' => 1, 'language' => 'fr', 'sort_by' => 'popularity.desc', 'release_date.gte' => '2015-01-01']); $vote = $client->getDiscoverApi()->discoverMovies(['page' => 1, 'language' => 'fr', 'sort_by' => 'vote_count.desc']); $cinema = $client->getDiscoverApi()->discoverMovies(['page' => 1, 'language' => 'fr', 'primary_release_date.gte' => '2015-12-15', 'primary_release_date.lte' => '2016-02-01']); return view('pages/home', ['popularity' => $popularity, 'vote' => $vote, 'cinema' => $cinema]); }
public function showTrois($tag) { $ids = session('ids'); $idss = session('ids'); $idss .= '|' . $tag . '|' . $ids; session(['ids' => $idss]); $token = new \Tmdb\ApiToken('API_KEY'); $client = new \Tmdb\Client($token, ['secure' => false]); $questions = Question::orderByRaw('RAND()')->take(1)->get(); $response = $client->getDiscoverApi()->discoverMovies(['page' => 1, 'language' => 'fr', 'with_keywords' => $idss]); return view('pages/question4', ['response' => $response, 'questions' => $questions]); }
/** * @test */ public function shouldBeAbleSetLogging() { $path = '/tmp/php-tmdb-api.log'; $this->client->setLogging(true, $path); $this->assertEquals(true, $this->client->getLogEnabled()); $this->assertEquals($path, $this->client->getLogPath()); }
public function show($id) { $token = new \Tmdb\ApiToken('API_KEY'); $client = new \Tmdb\Client($token, ['secure' => false]); $movie = $client->getMoviesApi()->getMovie($id, array('language' => 'fr')); $credits = $client->getMoviesApi()->getCredits($id); $images = $client->getMoviesApi()->getImages($id); $response = $client->getDiscoverApi()->discoverMovies(['page' => 1, 'language' => 'fr']); $trailers = $client->getMoviesApi()->getTrailers($id); return view('pages/movie', ['movie' => $movie, 'credits' => $credits, 'images' => $images, 'response' => $response, 'trailers' => $trailers]); }
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); $client->setSessionToken($sessionToken); /** * @var \Tmdb\Repository\AccountRepository $accountRepository */ $accountRepository = new \Tmdb\Repository\AccountRepository($client); $lists = $accountRepository->favorite(TMDB_ACCOUNT_ID, 150); var_dump($lists);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $review = $client->getReviewsApi()->getReview('5013bc76760ee372cb00253e'); var_dump($review);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../../vendor/autoload.php'; require_once '../../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $result = $client->getTvEpisodeApi()->getImages(1396, 2, 1); var_dump($result);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $response = $client->getDiscoverApi()->discoverTv(array('page' => 1, 'language' => 'en')); var_dump($response);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $result = $client->getSearchApi()->searchTv('breaking bad'); var_dump($result);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); $client->setSessionToken($sessionToken); $watchlist_movies = $client->getAccountApi()->getMovieWatchlist(TMDB_ACCOUNT_ID); var_dump($watchlist_movies);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $requestToken = new \Tmdb\RequestToken(TMDB_REQUEST_TOKEN); $client->getAuthenticationApi()->authenticateRequestToken($requestToken->getToken());
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $season = $client->getTvSeasonApi()->getSeason(1396, 2); var_dump($season);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../../vendor/autoload.php'; require_once '../../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $client->setCaching(true); $repository = new \Tmdb\Repository\MovieRepository($client); $movie = $repository->load(87421); var_dump($movie);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $movieChanges = $client->getChangesApi()->getMovieChanges(array('page' => 1, 'start_date' => '2014-01-01', 'end_date' => '2014-01-02')); var_dump($movieChanges);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); $client->setSessionToken($sessionToken); $list = $client->getListsApi()->getList('509ec17b19c2950a0600050d'); var_dump($list);
/** * get_metadata * Returns song metadata for what we're passed in. */ public function get_metadata($gather_types, $media_info) { debug_event('tmdb', 'Getting metadata from Tmdb...', '5'); // TVShow / Movie metadata only if (!in_array('tvshow', $gather_types) && !in_array('movie', $gather_types)) { debug_event('tmdb', 'Not a valid media type, skipped.', '5'); return null; } try { $token = new \Tmdb\ApiToken($this->api_key); $client = new \Tmdb\Client($token); $configRepository = new \Tmdb\Repository\ConfigurationRepository($client); $config = $configRepository->load(); $imageHelper = new \Tmdb\Helper\ImageHelper($config); $title = $media_info['original_name'] ?: $media_info['title']; $results = array(); if (in_array('movie', $gather_types)) { if (!empty($title)) { $apires = $client->getSearchApi()->searchMovies($title); if (count($apires['results']) > 0) { $results['tmdb_id'] = $apires['results'][0]['id']; $release = $client->getMoviesApi()->getMovie($results['tmdb_id']); $results['imdb_id'] = $release['imdb_id']; $results['original_name'] = $release['original_title']; if (!empty($release['release_date'])) { $results['release_date'] = strtotime($release['release_date']); $results['year'] = date("Y", $results['release_date']); // Production year shouldn't be the release date } if ($release['poster_path']) { $results['art'] = $imageHelper->getUrl($release['poster_path']); } if ($release['backdrop_path']) { $results['background_art'] = $imageHelper->getUrl($release['backdrop_path']); } $results['genre'] = self::get_genres($release); } } } if (in_array('tvshow', $gather_types)) { if (!empty($media_info['tvshow'])) { $apires = $client->getSearchApi()->searchTv($media_info['tvshow']); if (count($apires['results']) > 0) { // Get first match $results['tmdb_tvshow_id'] = $apires['results'][0]['id']; $release = $client->getTvApi()->getTvshow($results['tmdb_tvshow_id']); $results['tvshow'] = $release['original_name']; if (!empty($release['first_air_date'])) { $results['tvshow_year'] = date("Y", strtotime($release['first_air_date'])); } if ($release['poster_path']) { $results['tvshow_art'] = $imageHelper->getUrl($release['poster_path']); } if ($release['backdrop_path']) { $results['tvshow_background_art'] = $imageHelper->getUrl($release['backdrop_path']); } $results['genre'] = self::get_genres($release); if ($media_info['tvshow_season']) { $release = $client->getTvSeasonApi()->getSeason($results['tmdb_tvshow_id'], $media_info['tvshow_season']); if ($release['id']) { if ($release['poster_path']) { $results['tvshow_season_art'] = $imageHelper->getUrl($release['poster_path']); } if ($media_info['tvshow_episode']) { $release = $client->getTvEpisodeApi()->getEpisode($results['tmdb_tvshow_id'], $media_info['tvshow_season'], $media_info['tvshow_episode']); if ($release['id']) { $results['tmdb_id'] = $release['id']; $results['tvshow_season'] = $release['season_number']; $results['tvshow_episode'] = $release['episode_number']; $results['original_name'] = $release['name']; if (!empty($release['air_date'])) { $results['release_date'] = strtotime($release['release_date']); $results['year'] = date("Y", $results['release_date']); } $results['description'] = $release['overview']; if ($release['still_path']) { $results['art'] = $imageHelper->getUrl($release['still_path']); } } } } } } } } } catch (Exception $e) { debug_event('tmdb', 'Error getting metadata: ' . $e->getMessage(), '1'); } return $results; }
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $timezones = $client->getTimezonesApi()->getTimezones(); var_dump($timezones);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $keyword = $client->getKeywordsApi()->getKeyword(1721); var_dump($keyword);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $collection = $client->getCollectionsApi()->getImages(10); var_dump($collection);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $result = $client->getSearchApi()->searchList('award'); var_dump($result);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $person = $client->getPeopleApi()->getPerson(33); var_dump($person);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $keywords = $client->getMoviesApi()->getKeywords(87421); var_dump($keywords);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $latestMovies = $client->getPeopleApi()->getLatest(); var_dump($latestMovies);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ header('Content-Type: text/html; charset=utf-8'); require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $movie = $client->getMoviesApi()->getMovie(87421); var_dump($movie);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); $client->setSessionToken($sessionToken); $lists = $client->getAccountApi()->getLists(TMDB_ACCOUNT_ID); var_dump($lists);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token, ['session_token' => new \Tmdb\SessionToken(TMDB_SESSION_TOKEN)]); $account = $client->getAccountApi()->getAccount(); var_dump($account);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../vendor/autoload.php'; require_once '../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $plugin = new \Tmdb\HttpClient\Plugin\LanguageFilterPlugin('nl'); $client->getHttpClient()->addSubscriber($plugin);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); /** $sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); $client->setSessionToken($sessionToken); */ $guestSessionToken = new \Tmdb\GuestSessionToken(TMDB_GUEST_SESSION_TOKEN); $client->setSessionToken($guestSessionToken); $repository = new \Tmdb\Repository\MovieRepository($client); $rate = $repository->rate(49047, 6.5); var_dump($rate);
<?php /** * This file is part of the Tmdb PHP API created by Michael Roterman. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @package Tmdb * @author Michael Roterman <*****@*****.**> * @copyright (c) 2013, Michael Roterman * @version 0.0.1 */ require_once '../../../vendor/autoload.php'; require_once '../../../apikey.php'; $token = new \Tmdb\ApiToken(TMDB_API_KEY); $client = new \Tmdb\Client($token); $credits = $client->getPeopleApi()->getMovieCredits(33); var_dump($credits);