sparks-coding/movie-information
Composer 安装命令:
composer require sparks-coding/movie-information
包简介
Wrapper for the OMDb API
README 文档
README
A Simple PHP Wrapper for the OMDb API (https://www.omdbapi.com/)
Usage
// Include the Class require 'MovieInformation.php'; // Namespace use SparksCoding\MovieInformation\MovieInformation; // Get move by title $movie = new MovieInformation('The Matrix', array('plot'=>'full', 'tomatoes'=>'true')); echo $movie->title; // The Matrix echo $movie->year; // 1999 echo $movie->rated; // R echo $movie->released; // 31 Mar 1999 echo $movie->runtime; // 136 min echo $movie->genre; // Action, Sci-Fi echo $movie->director; // Andy Wachowski, Lana Wachowski echo $movie->actors; // Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving echo $movie->plot; // A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against its controllers. echo $movie->language; // English echo $movie->country; // USA, Australia echo $movie->awards; // Won 4 Oscars. Another 34 wins & 39 nominations. echo $movie->poster; // http://ia.media-imdb.com/images/M/MV5BMTkxNDYxOTA4M15BMl5BanBnXkFtZTgwNTk0NzQxMTE@._V1_SX300.jpg echo $movie->metascore; // 73 echo $movie->imdbRating; // 8.7 echo $movie->imdbVotes; // 1023621 echo $movie->imdbID; // tt0133093 // Additional Information Returned when 'tomatoes' is set to true echo $movie->tomatoMeter; // RT Meter echo $movie->tomatoImage; // RT Image echo $movie->tomatoRating; // RT Rating echo $movie->tomatoReviews; // Number of RT Reviews echo $movie->tomatoFresh; // Number of RT Fresh Reviews echo $movie->tomatoRotten; // Number of RT Rotten Reviews echo $movie->tomatoConsensus; // RT Consensus echo $movie->tomatoUserMeter; // RT User Meter echo $movie->tomatoUserRating; // RT User Rating echo $movie->tomatoUserReviews; // Number of RT User Reviews echo $movie->dvd; // DVD Release Date echo $movie->boxOffice; // Box Office echo $movie->production; // Production Company echo $movie->website; // Movie Website // Get movie by IMDB ID $movie = new MovieInformation('tt0133093'); echo $movie->title; // The Matrix
Options
| Option | Values | Default | Description |
|---|---|---|---|
| plot | short, full | short | Return short or full movie plot |
| tomatoes | true, false | false | Return additional information from Rotten Tomatoes |
Methods
get($key, $asArray)
Get the value of specified key. Optionally return the value as an array.
// As String $actors = $movie->get('actors'); echo $actors // Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving // As Array $actors = $movie->get('actors', true); print_r($actors); // Array ( [0] => Keanu Reeves [1] => Laurence Fishburne [2] => Carrie-Anne Moss [3] => Hugo Weaving )
getMultiple(array('title', 'year'))
Get multiple values returned in an array.
$multiple = $movie->getMultiple(array('title', 'year', 'genre', 'dvd')); print_r($multiple); // Array // ( // [title] => The Matrix // [year] => 1999 // [genre] => Action, Sci-Fi // [dvd] => 21 Sep 1999 // )
getAll($asJson)
Get all the movie's information as an array or JSON.
$all = $movie->getAll(); print_r($all); // Array // ( // [title] => The Matrix // [year] => 1999 // [rated] => R // [released] => 31 Mar 1999 // [runtime] => 136 min // [genre] => Action, Sci-Fi // [director] => Andy Wachowski, Lana Wachowski // [writer] => Andy Wachowski, Lana Wachowski // [actors] => Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving // [plot] => A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against its controllers. // [language] => English // [country] => USA, Australia // [awards] => Won 4 Oscars. Another 34 wins & 40 nominations. // [poster] => http://ia.media-imdb.com/images/M/MV5BMTkxNDYxOTA4M15BMl5BanBnXkFtZTgwNTk0NzQxMTE@._V1_SX300.jpg // [metascore] => 73 // [imdbRating] => 8.7 // [imdbVotes] => 1,037,112 // [imdbID] => tt0133093 // [type] => movie // [tomatoMeter] => 87 // [tomatoImage] => certified // [tomatoRating] => 7.6 // [tomatoReviews] => 139 // [tomatoFresh] => 121 // [tomatoRotten] => 18 // [tomatoConsensus] => Thanks to the Wachowskis' imaginative vision, The Matrix is a smartly crafted combination of spectacular action and groundbreaking special effects. // [tomatoUserMeter] => 85 // [tomatoUserRating] => 3.6 // [tomatoUserReviews] => 33317892 // [dvd] => 21 Sep 1999 // [boxOffice] => N/A // [production] => Warner Bros. Pictures // [website] => http://www.whatisthematrix.com // [response] => True // ) // As JSON $json = $movie->getAll(true); echo $json; // {"title":"The Matrix","year":"1999","rated":"R","released":"31 Mar 1999","runtime":"136 min","genre":"Action, Sci-Fi","director":"Andy Wachowski, Lana Wachowski","writer":"Andy Wachowski, Lana Wachowski","actors":"Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving","plot":"A computer hacker learns from mysterious rebels about the true nature of his reality and his role in the war against its controllers.","language":"English","country":"USA, Australia","awards":"Won 4 Oscars. Another 34 wins & 40 nominations.","poster":"http:\/\/ia.media-imdb.com\/images\/M\/MV5BMTkxNDYxOTA4M15BMl5BanBnXkFtZTgwNTk0NzQxMTE@._V1_SX300.jpg","metascore":"73","imdbRating":"8.7","imdbVotes":"1,037,112","imdbID":"tt0133093","type":"movie","tomatoMeter":"87","tomatoImage":"certified","tomatoRating":"7.6","tomatoReviews":"139","tomatoFresh":"121","tomatoRotten":"18","tomatoConsensus":"Thanks to the Wachowskis' imaginative vision, The Matrix is a smartly crafted combination of spectacular action and groundbreaking special effects.","tomatoUserMeter":"85","tomatoUserRating":"3.6","tomatoUserReviews":"33317892","dvd":"21 Sep 1999","boxOffice":"N\/A","production":"Warner Bros. Pictures","website":"http:\/\/www.whatisthematrix.com","response":"True"}
To Do
This is a work in progress. More robust options are on the way.
sparks-coding/movie-information 适用场景与选型建议
sparks-coding/movie-information 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 59 次下载、GitHub Stars 达 7, 最近一次更新时间为 2015 年 05 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「movies」 「movie」 「imdb.com」 「omdbapi.com」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sparks-coding/movie-information 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sparks-coding/movie-information 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sparks-coding/movie-information 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
IMDB API that can fetch film data and search results
Library for retrieving movie, tv series information from imdb.com
An example project using a multi layer feed forward neural network for text sentiment classification trained with 25,000 movie reviews from IMDB.
Library for parsing metadata information about movies and TV shows from Douban Movie
An AirPlay friendly web interface to stream your movies and TV shows from a home server.
xMDB parser
统计信息
- 总下载量: 59
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPLv3
- 更新时间: 2015-05-26