rexlmanu/laravel-tmdb
Composer 安装命令:
composer require rexlmanu/laravel-tmdb
包简介
Laravel SDK for the TMDB API
README 文档
README
Laravel package for using the TMDB API.
Installation
You can install the package via composer:
composer require chiiya/laravel-tmdb
Next, configure your TMDB API token in your .env file. This should be your API Read Access Token (v4 auth):
TMDB_API_TOKEN="eyJh..."
Usage
This package is a thin wrapper around chiiya/tmdb-php, that allows you to directly inject the repositories in your application:
use Chiiya\Tmdb\Repositories\MovieRepository; use Chiiya\Tmdb\Query\AppendToResponse; class TmdbService { public function __construct( private MovieRepository $movies, ) public function handle(): void { $this->movies->getMovie(550); $this->movies->getPopular(); $movie = $this->movies->getMovie(550, [ new AppendToResponse([ AppendToResponse::IMAGES, AppendToResponse::WATCH_PROVIDERS, ]), ]); $movie->watch_providers['US']->flatrate[0]->provider_name; } }
For documentation on method signatures, check out chiiya/tmdb-php.
Testing
Since this package uses the Laravel HTTP Client under the hood to perform API requests,
you may simply call Http::fake() to fake responses in your tests. For mocking specific responses,
check out the example responses.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-09