PHP code example of gabrielesbaiz / unsplash-toolkit
1. Go to this page and download the library: Download gabrielesbaiz/unsplash-toolkit library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gabrielesbaiz / unsplash-toolkit example snippets
return [
'access_key' => env('UNSPLASH_ACCESS_KEY'),
'store_in_database' => env('UNSPLASH_STORE_IN_DATABASE', false),
'disk' => env('UNSPLASH_STORAGE_DISK', 'local'),
'app_name' => env('UNSPLASH_APP_NAME', 'your_app_name'),
];
bash
php artisan vendor:publish --tag="unsplash-toolkit-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="unsplash-toolkit-config"
php
// Returns the http response body.
$twoRandomPhotosOfSomePeoples = UnsplashToolkit::randomPhoto()
->orientation('portrait')
->term('people')
->count(2)
->toJson();
// Store the image in on your provided disc
$theNameFromTheStoredPhoto = UnsplashToolkit::randomPhoto()
->orientation('landscape')
->term('music')
->randomPhoto()
->store();
];
php
$photos = UnsplashToolkit::photos()->toJson();
$photo = UnsplashToolkit::photo($id)->toJson();
$photosStatistics = UnsplashToolkit::photosStatistics($id)->toJson();
$trackPhotoDownload = UnsplashToolkit::trackPhotoDownload($id)->toJson();
php
$user = UnsplashToolkit::user($username)->toJson();
$userPortfolio = UnsplashToolkit::userPortfolio($username)->toJson();
$userPhotos = UnsplashToolkit::userPhotos($username)->toJson();
$userLikes = UnsplashToolkit::userLikes($username)->toJson();
$userCollections = UnsplashToolkit::userCollections($username)->toJson();
$userStatistics = UnsplashToolkit::userStatistics($username)->toJson();
php
$collectionsList = UnsplashToolkit::collectionsList()
->page($pageNumber)
->perPage($itemsPerPage)
->toJson();
$featuredCollection = UnsplashToolkit::featuredCollection()
->page($pageNumber)
->perPage($itemsPerPage)
->toJson();
$showCollection = UnsplashToolkit::showCollection()
->id($collectionId)
->toJson();
$showCollectionPhotos = UnsplashToolkit::showCollectionPhotos()
->id($collectionId)
->toJson();
$showCollectionRelatedCollections = UnsplashToolkit::showCollectionRelatedCollections()
->id($collectionId)
->toJson();
php
$totalStats = UnsplashToolkit::totalStats()->toJson();
$monthlyStats = UnsplashToolkit::monthlyStats()->toJson();