The Laravel Unsplash package provides an easy way to integrate your Laravel project with the Unsplash API. Use the API to fetch photos, collections, and user data from Unsplash:
use Xchimx\UnsplashApi\Facades\Unsplash; $photos = Unsplash::searchPhotos('Nature');$randomPhoto = Unsplash::getRandomPhoto('Nature');$downloadLink = Unsplash::getPhotoDownloadLink($id);$user = Unsplash::getUser($name);$userPhotos = Unsplash::getUserPhotos($username, 15, $page);
Package Features
- Photo search, advanced photo search, and collections search
- Get photos by ID or get a random photos
- Get users and user photos
- Rate limiting middleware
- And more...
This package is available on GitHub at xchimx/laravel-unsplash. The readme includes installation, configuration details, usage instructions, and controller examples. To get started with the Unsplash API, you will need to register as a developer by visiting the official developer documentation.
You can install this package with Composer:
$ composer require xchimx/laravel-unsplash $ php artisan vendor:publish \ --provider="Xchimx\UnsplashApi\UnsplashServiceProvider" --tag="config"