josmlt / tmdb-laravel-wrapper
A Laravel wrapper for The Movie Database API
Installs: 31
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^7.3|^8.0
- guzzlehttp/guzzle: ^7.0.1
- illuminate/support: ^8.50
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-08-11 20:37:29 UTC
README
The Movie Database Laravel Wrapper
This is a package develop with Laravel 8. It's a Laravel api wrapper to get info about movies, tv shows and more using TMDB Api and Laravel Facades.
Steps to installation đ
It's necessary to be register in The Movie Database and get a valid api key, it just take a moment.
Package Locally Development âšī¸
We need to create a folder and within it we'll create a Laravel project and clone the repository. Structure similar to this :
-- foo
-- laravel_project
-- package_laravel
After that, open composer.json
file in our main Laravel project, add :
"require": {
[. . .]
"josmlt/tmdb-laravel-wrapper": "dev-master",
}
"repositories": [
{
"type": "path",
"url": "../tmdb-wrapper"
}
],
Now require the package to the project, execute :
composer require josmlt/tmdb-laravel-wrapper
Then execute, it will publish the config file :
php artisan vendor:publish --tag=tmdb
Finally we have two options, first we could have a default value of TMDB_KEY, within config/tmdb.php
or as well we can add in our .env
a new environment variable like TMDB_KEY = ""
From Packagist âšī¸
composer require josmlt/tmdb-laravel-wrapper
Now we need to publish the config file :
php artisan vendor:publish --tag=tmdb
Finally we move into :
config/tmdb.php
And add our api key from The Movie Database, or alternative you can create a new environment variable named like TMDB_KEY
.
How to use it â
đ Get top movies or tv shows.
\TMDB::getTop('tv', ['page' => 2]);
đ Get more details about a specific movie, tv shows or an actor, set the last parameter to true and get available videos.
\TMDB::getDetails('movie', 3333, true);
đ To search movies, tv shows and people use search method or searchAsync to do an asyncronus search, usefull when you have to send multiple request.
\TMDB::searchAsync('person', 'tom'));
đ Discover new movies with the follow method, it's also provided with many filter and sorting options, an example of use.
\TMDB::movieDiscover(
'without_genres' => 28,
'year' => '2020'
);
Testing âī¸
This package provides tests to get more confident using the package and check if it's possible to add a new feature without broke nothing valuable.
To execute tests :
vendor/bin/phpunit tests/Unit/TMDBTest.php