duyplus/tmdbapi
Composer 安装命令:
composer require duyplus/tmdbapi
包简介
TMDB API v3 PHP client library, updated for CI4 compatibility
关键字:
README 文档
README
TMDB API v3 PHP Library - wrapper to API version 3 of themoviedb.org. With the TMDB API v3 PHP Library, you can easily access information about movies, actors, reviews, genres, and many other related data. The library supports basic HTTP requests and automatically handles JSON responses, enabling you to quickly and efficiently integrate TMDB functionalities into your PHP projects with flexibility.
Installation
You can install the TMDB API via Composer:
composer require duyplus/tmdbapi
Requirements
- PHP 5.3.x or higher
- cURL
- TMDB API Key (get key from here)
Documentation
Changelog
Initialize the class
If you have a $conf array
use Duyplus\TMDBApi\TMDB; // if you have a $conf array - (See LIB_ROOT/src/Config/Default.php as an example) $tmdb = new TMDB($conf);
If you have no $conf array it uses the default conf but you need to have an API Key
use Duyplus\TMDBApi\TMDB; // if you have no $conf it uses the default config $tmdb = new TMDB(); //Insert your API Key of TMDB //Necessary if you use default conf $tmdb->setAPIKey('YOUR_API_KEY');
Movies
Search a Movie
//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.
$idMovie = 11; $movie = $tmdb->getMovie($idMovie); // returns a Movie Object echo $movie->getTitle();
returns a Movie Object.
TV Shows
Search a TV Show
// 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.
$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.
$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.
$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
// 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.
$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.
$movieRoles = $person->getMovieRoles(); foreach ($movieRoles as $movieRole) { echo $movieRole->getCharacter() . ' in ' . $movieRole->getMovieTitle() . '<br>'; }
returns an array of MovieRole Objects.
$tvShowRoles = $person->getTVShow(); foreach ($tvShowRoles as $tvShowRole) { echo $tvShowRole->getCharacter() . ' in ' . $tvShowRole->getMovieName() . '<br>'; }
returns an array of TVShowRole Objects.
Collections
Search a Collection
// Name to search for $name = 'the hobbit'; $collections = $tmdb->searchCollection($name); 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.
$idCollection = 121938; $collection = $tmdb->getCollection($idCollection); // returns a Collection Object echo $collection->getName();
returns a Collection Object.
Companies
Search a Company
// Name to search for $name = 'Sony'; $companies = $tmdb->searchCompany($name); foreach ($companies as $company) { echo $company->getName() . '<br>'; }
returns an array of Company Objects.
Get a Company
You should take a look at the Company class Documentation and see all the info you can get from a Company Object.
$idCompany = 34; $company = $tmdb->getCompany($idCompany); // returns a Company Object echo $company->getName();
returns a Company Object.
Credits
@author Pixelead0 also on Github
@author Deso85 also on Github
Forked from a similar project by Burhan Ibrahimi
License
This project is licensed under the MIT License. See the LICENSE file for details.
duyplus/tmdbapi 适用场景与选型建议
duyplus/tmdbapi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 12 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「wrapper」 「tmdb」 「codeigniter4」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 duyplus/tmdbapi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 duyplus/tmdbapi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 duyplus/tmdbapi 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
A PSR-7 compatible library for making CRUD API endpoints
gv config package
xMDB parser
PHP wrapper for TMDB (TheMovieDatabase) API v3. Supports two types of approaches, one modelled with repositories, models and factories. And the other by simple array access to RAW data from The Movie Database.
统计信息
- 总下载量: 38
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-31