joaquinpereira / laravel-pexels
library to consume the pexels api (https://www.pexels.com/)
dev-master
2023-07-17 20:48 UTC
Requires
- illuminate/support: ^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- orchestra/testbench: dev-develop
- phpunit/phpunit: ^10.3@dev
This package is auto-updated.
Last update: 2024-12-17 23:50:38 UTC
README
This is a package made for laravel, that connects to the pexels api and gets images or videos.
Requirements
- PHP >= 7.2
- Account at https://www.pexels.com/ and obtain the api key
Installation
composer require joaquinpereira/laravel-pexels
Configuration
You must publish the config/pexel.php configuration file with the following command:
php artisan vendor:publish --provider="joaquinpereira\Pexels\Providers\PexelsServiceProvider" --tag="config"
In the .env file of the project you must add the following key PEXELS_API_KEY and place the value of your key provided by the pexels site
PEXELS_API_KEY="YOUR_PEXELS_API_KEY"
Examples of use:
use joaquinpereira\Pexels\Facades\Pexels; Route::get('/pexels', function () { //Images dump(Pexels::image_search('modern apartment')); dump(Pexels::image_search('modern apartment',20, 25)); dump(Pexels::image_curated()); dump(Pexels::image_curated(3,15)); dump(Pexels::image_detail(17579690)); dump(Pexels::getRandomImage('beach','landscape')); //videos dump(Pexels::video_search('android robot')); dump(Pexels::video_search('android robot', 3, 15)); dump(Pexels::popular_videos()); dump(Pexels::popular_videos(5,20)); dump(Pexels::getRandomVideo('dogs')); dump(Pexels::video_detail(15570408)); });