{"id":15679449,"url":"https://github.com/rasmuslindroth/omdb-php-api","last_synced_at":"2025-05-07T09:47:19.608Z","repository":{"id":27690313,"uuid":"31176852","full_name":"RasmusLindroth/OMDb-PHP-API","owner":"RasmusLindroth","description":"A wrapper for the OMDb API that gets movie info from IMDb and Rotten Tomatoes.","archived":false,"fork":false,"pushed_at":"2018-11-15T14:59:58.000Z","size":22,"stargazers_count":12,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T08:51:15.317Z","etag":null,"topics":["imdb","movie-info","omdb-api","php","rotten-tomatoes","wrapper"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RasmusLindroth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-22T19:42:16.000Z","updated_at":"2021-03-01T20:37:43.000Z","dependencies_parsed_at":"2022-09-07T17:13:00.957Z","dependency_job_id":null,"html_url":"https://github.com/RasmusLindroth/OMDb-PHP-API","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RasmusLindroth%2FOMDb-PHP-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RasmusLindroth%2FOMDb-PHP-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RasmusLindroth%2FOMDb-PHP-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RasmusLindroth%2FOMDb-PHP-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RasmusLindroth","download_url":"https://codeload.github.com/RasmusLindroth/OMDb-PHP-API/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252854369,"owners_count":21814674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["imdb","movie-info","omdb-api","php","rotten-tomatoes","wrapper"],"created_at":"2024-10-03T16:31:10.839Z","updated_at":"2025-05-07T09:47:19.588Z","avatar_url":"https://github.com/RasmusLindroth.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OMDb-PHP-API\nA wrapper for the OMDb API that gets movie info from IMDb and Rotten Tomatoes.\n\n### How to use\nDo not forget to replace your apikey that you must get from [the OMDb website](http://www.omdbapi.com/apikey.aspx).\n```php\n//Init OMDb\n$omdb = new OMDb();\n\n//Set parameters, include data from Rotten Tomatoes and show full plot\n$omdb-\u003esetParams( ['tomatoes' =\u003e TRUE, 'plot' =\u003e 'full', 'apikey' =\u003e '00000000'] );\n\n//Only set one parameter, the movie has to be from 2015\n$omdb-\u003esetParam( 'y', 2015 );\n\n//Remove one parameter\n$omdb-\u003eunsetParam('y');\n\n//Get by title\n$movie = $omdb-\u003eget_by_title( 'Pulp Fiction' );\n\n//Get by IMDb id\n$movie = $omdb-\u003eget_by_id( 'tt0057012' );\n\n//Get all episodes in season 1, (also works for get_by_title)\n$movie = $omdb-\u003eget_by_id('tt2085059', 1 );\n\n//Get episode 2 for season 1, (also works for get_by_title)\n$movie = $omdb-\u003eget_by_id('tt2085059', 1, 2 );\n\n//Search for (multiple) movies\n//ignores the params plot and tomatoes\n$movie = $omdb-\u003esearch( 'James Bond' );\n\n//Search with pagination\n$movie = $omdb-\u003esearch( 'Alfred', 2 );\n```\n\n### Parameters for the constructor (can be left empty, except for your apikey)\n```php\n$omdb = new OMDb($params = ['apikey' =\u003e '00000000'], $timeout = 5, $date_format = 'Y-m-d');\n```\n\n\u003cb\u003eparams\u003c/b\u003e: has to be an array, see API parameters for parameter reference\u003cbr\u003e\n\u003cb\u003etimeout\u003c/b\u003e: cURL/request timeout in seconds\u003cbr\u003e\n\u003cb\u003edate_format\u003c/b\u003e: http://php.net/manual/function.date.php and NULL for UNIX time\n\n\n### API parameters\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eParameter\u003c/th\u003e\n        \u003cth\u003eValid Options\u003c/th\u003e\n        \u003cth\u003eDefault value\u003c/th\u003e\n        \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eapikey\u003c/td\u003e\n        \u003ctd\u003e\u003c/td\u003e\n        \u003ctd\u003e00000000\u003c/td\u003e\n        \u003ctd\u003eAPI key as received from \u003ca href=\"http://www.omdbapi.com/apikey.aspx\"\u003ethe OMDb website\u003c/a\u003e.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003etype\u003c/td\u003e\n        \u003ctd\u003emovie, series, episode\u003c/td\u003e\n        \u003ctd\u003eNULL\u003c/td\u003e\n        \u003ctd\u003eType of result\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003ey\u003c/td\u003e\n        \u003ctd\u003e\u003c/td\u003e\n        \u003ctd\u003eNULL\u003c/td\u003e\n        \u003ctd\u003eYear of release \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eplot\u003c/td\u003e\n        \u003ctd\u003eshort, full\u003c/td\u003e\n        \u003ctd\u003eshort\u003c/td\u003e\n        \u003ctd\u003ePlot-length, ignored when you use the search-method\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003etomatoes\u003c/td\u003e\n        \u003ctd\u003eTRUE, FALSE\u003c/td\u003e\n        \u003ctd\u003eFALSE\u003c/td\u003e\n        \u003ctd\u003eInclude Rotten Tomatoes, ignored when you use the search-method\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n### Methods\n```php\n//Returns array(Title, Year, imdbID, Type, ...)\n$omdb-\u003eget_by_title( 'title', [, $season = NULL, $episode = NULL] );\n$omdb-\u003eget_by_id( 'tt[0-9]', [, $season = NULL, $episode = NULL] );\n\n//Returns array(\n//      'Search' =\u003e array(Title, Year, imdbID, Type), array(...)\n//             )\n$omdb-\u003esearch( 'Search term', [, $page = NULL] );\n```\n\n### Errors\nThis class throws exceptions if you for instance sends a string to a function\nthat's expecting an array. If the API runs in to some error I have choosen not\nto throw an exception. You will have to implent it yourself.\n\nYou can check for API errors if the value of the key 'Response' is TRUE or if\nthe key 'Error' exists in the result.\n\nExample:\n```php\n$omdb-\u003eget_by_title( 'gasdgasdgadgasdgasdg' );\n\n//Returns\narray(\n    'Response' =\u003e FALSE,\n    'Error' =\u003e 'Movie not found!'\n);\n```\n\n### Output example\n```php\narray (size=34)\n  'Title' =\u003e string 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb'\n  'Year' =\u003e string '1964'\n  'Rated' =\u003e string 'PG'\n  'Released' =\u003e string '1964-01-29'\n  'Runtime' =\u003e int 95\n  'Genre' =\u003e\n    array (size=2)\n      0 =\u003e string 'Comedy'\n      1 =\u003e string 'War'\n  'Director' =\u003e string 'Stanley Kubrick'\n  'Writer' =\u003e\n    array (size=4)\n      0 =\u003e string 'Stanley Kubrick (screenplay)'\n      1 =\u003e string 'Terry Southern (screenplay)'\n      2 =\u003e string 'Peter George (screenplay)'\n      3 =\u003e string 'Peter George (based on the book: \"Red Alert\" by)'\n  'Actors' =\u003e\n    array (size=4)\n      0 =\u003e string 'Peter Sellers'\n      1 =\u003e string 'George C. Scott'\n      2 =\u003e string 'Sterling Hayden'\n      3 =\u003e string 'Keenan Wynn'\n  'Plot' =\u003e string 'An insane general triggers a path to nuclear holocaust that a war room full of politicians and generals frantically try to stop.'\n  'Language' =\u003e\n    array (size=2)\n      0 =\u003e string 'English'\n      1 =\u003e string 'Russian'\n  'Country' =\u003e\n    array (size=2)\n      0 =\u003e string 'USA'\n      1 =\u003e string 'UK'\n  'Awards' =\u003e string 'Nominated for 4 Oscars. Another 15 wins \u0026 4 nominations.'\n  'Poster' =\u003e string 'http://ia.media-imdb.com/images/M/MV5BMTU2ODM2NTkxNF5BMl5BanBnXkFtZTcwOTMwMzU3Mg@@._V1_SX300.jpg'\n  'Metascore' =\u003e int 96\n  'imdbRating' =\u003e float 8.5\n  'imdbVotes' =\u003e int 291737\n  'imdbID' =\u003e string 'tt0057012'\n  'Type' =\u003e string 'movie'\n  'tomatoMeter' =\u003e int 99\n  'tomatoImage' =\u003e string 'certified'\n  'tomatoRating' =\u003e float 9\n  'tomatoReviews' =\u003e int 68\n  'tomatoFresh' =\u003e int 67\n  'tomatoRotten' =\u003e int 1\n  'tomatoConsensus' =\u003e string 'Stanley Kubrick's brilliant Cold War satire remains as funny and razor-sharp today as it was in 1964.'\n  'tomatoUserMeter' =\u003e int 94\n  'tomatoUserRating' =\u003e float 4.2\n  'tomatoUserReviews' =\u003e int 204995\n  'DVD' =\u003e string '02 Nov 2004'\n  'BoxOffice' =\u003e null\n  'Production' =\u003e string 'Sony Pictures'\n  'Website' =\u003e null\n  'Response' =\u003e boolean true\n  'Ratings' =\u003e\n    array(3)\n      0 =\u003e\n        array(2)\n          Source =\u003e string \"Internet Movie Database\"\n          value =\u003e string \"8.9/10\"\n      1 =\u003e\n        array(2)\n          Source =\u003e string \"Rotten Tomatoes\"\n          value =\u003e string \"94%\"\n      2 =\u003e\n        array(2)\n          Source =\u003e string \"Metacritic\"\n          value =\u003e string \"94/100\"\n  'tomatoURL' =\u003e string 'http://www.rottentomatoes.com/m/dr_strangelove/'\n```\n\nThanks to Brian Fritz, the author of OMDb APIs\u003cbr\u003e\nThe API webpage\nhttp://www.omdbapi.com/\n\nThis PHP wrapper is made by Rasmus Lindroth\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasmuslindroth%2Fomdb-php-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frasmuslindroth%2Fomdb-php-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasmuslindroth%2Fomdb-php-api/lists"}