Skip to content

femotizo/tmdb_v3-PHP-API-

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Documentation

Join the chat at https://gitter.im/pixelead0/tmdb_v3-PHP-API-

TMDB API v3 PHP Library - wrapper to API version 3 of themoviedb.org. API Documentation: http://help.themoviedb.org/kb/api/about-3

For using this library maybe you should take a look at the full Documentation of this project.

@pakage TMDB_V3_API_PHP
@author Pixelead0 also on Github
@author Alvaro Octal also on Github
@date 17/01/2015
@version 0.3

CREDITS

Forked from a similar project by Jonas De Smet

CHANGE LOG

  • [17/01/2015] v0.3 - Upgraded by

  • [07/11/2012] v0.2

    • Fixed issue #2 (Object created in class php file)
    • Added functions latestMovie, nowPlayingMovies (thank's to steffmeister)
  • [12/02/2012] v0.1

    • This is the first version of the class without inline documentation or testing
    • Forked from glamorous/TMDb-PHP-API

Requirements

  • PHP 5.2.x or higher
  • cURL
  • TMDB API-key

How to use

View examples/

Initialize the class

<?php
	include('tmdb-api.php');

	// Insert your api key of TMDB
	$apikey = 'YOUR_APIKEY';
	$language = 'es';
	$tmdb = new TMDB($apikey, $language); // by simply giving $apikey it sets the default lang to 'en'
?>

Movies

Search a Movie

<?php
	//Title to search for
	$title = 'back to the future';
	$movies = $tmdb->searchMovie($title);
	// returns an array of Movie Object
	foreach($movies as $movie){
		echo $movie->getTitle() .'<br>;
	}
?>

returns an array of Movie Objects.

Get a Movie

You should take a look at the Movie class Documentation and see all the info you can get from a Movie Object.

<?php
	$idMovie = 11;
	$movie = $tmdb->getMovie($idMovie);
	// returns a Movie Object
	echo $movie->getTitle();
?>

returns a Movie Object.

TV Shows

Search a TV Show

<?php
	// Title to search for
	$title = 'breaking bad';
	$tvShows = $tmdb->searchTVShow($title);
    foreach($tvShows as $tvShow){
        echo $tvShow->getName() .'<br>';
	}
?>

returns an array of TVShow Objects.

Get a TVShow

You should take a look at the TVShow class Documentation and see all the info you can get from a TVShow Object.

<?php
	$idTVShow = 1396;
	$tvShow = $tmdb->getTVShow($idTVShow);
	// returns a TVShow Object
	echo $tvShow->getName();
?>

returns a TVShow Object.

Get a TVShow's Season

You should take a look at the Season class Documentation and see all the info you can get from a Season Object.

<?php
	$idTVShow = 1396;
	$numSeason = 2;
	$season = $tmdb->getSeason($idTVShow, $numSeason);
	// returns a Season Object
	echo $season->getName();
?>

returns a Season Object.

Get a TVShow's Episode

You should take a look at the Episode class Documentation and see all the info you can get from a Episode Object.

<?php
	$idTVShow = 1396;
	$numSeason = 2;
	$numEpisode = 8;
	$episode = $tmdb->getEpisode($idTVShow, $numSeason, $numEpisode);
	// returns a Episode Object
	echo $episode->getName();
?>

returns a Episode Object.

Persons

Search a Person

<?php
	// Name to search for
	$name = 'Johnny';
	$persons = $tmdb->searchPerson($name);
    foreach($persons as $person){
        echo $person->getName() .'<br>';
    }
?>

returns an array of Person Objects.

Get a Person

You should take a look at the Person class Documentation and see all the info you can get from a Person Object.

<?php
	$idPerson = 85;
	$person = $tmdb->getPerson($idPerson);
	// returns a Person Object
	echo $person->getName();
?>

returns a Person Object.

Get Person's Roles

You should take a look at the Role class Documentation and see all the info you can get from a Role Object.

<?php
	$movieRoles = $person->getMovieRoles();
	foreach($movieRoles as $movieRole){
        echo $movieRole->getCharacter() .' in '. $movieRole->getMovieTitle() .'<br>';
    }
?>

returns an array of MovieRole Objects.

<?php
	$tvShowRoles = $person->getTVShow();
	foreach($tvShowRoles as $tvShowRole){
        echo $tvShowRole->getCharacter() .' in '. $tvShowRole->getMovieName() .'<br>';
    }
?>

returns an array of TVShowRole Objects.

Collections

Search a Collection

<?php
	// Name to search for
	$title = 'the hobbit';
	$collections = $tmdb->searchCollection($title);
	foreach($collections as $collection){
		echo $collection->getName() .'<br>';
	}
?>

returns an array of Collection Objects.

Get a Collection

You should take a look at the Collection class Documentation and see all the info you can get from a Collection Object.

<?php
	$idCollection = 121938;
	$collection = $tmdb->getCollection($idCollection);
	// returns a Collection Object
	echo $collection->getName();
?>

returns a Collection Object.

Issues/Bugs

Bugs are expected, this is still under development, you can report them.

TODO List

  • Empty :D, you can propose new functionalities.

About

wrapper in PHP for The Movie Data Base version 3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%