PHP code example of scottybo / laravel-unsplash

1. Go to this page and download the library: Download scottybo/laravel-unsplash 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/ */

    

scottybo / laravel-unsplash example snippets

 bash
$ php artisan vendor:publish --provider="Scottybo\LaravelUnsplash\LaravelUnsplashServiceProvider"
 php
$unsplash  = new Scottybo\LaravelUnsplash\Photo();
$photos    = $unsplash->photos($params)->get();          // list of all photos
$photo     = $unsplash->single($id, $params)->get();     // single photo
$statistic = $unsplash->statistic($id, $params)->get();  // single photo statistics
$link      = $unsplash->download($id);                   // single photo download link
$photos    = $unsplash->curated($params)->get();         // list of curated photos
$photo     = $unsplash->random($params)->get();          // random photo
 php
$photos = $unsplash->random($params)->getURL(); // return https://source.unsplash.com/WLUHO9A_xik/1600x900
 php
$unsplash     = new Scottybo\LaravelUnsplash\User();
$user         = $unsplash->single($username, $params)->get();       // single user
$portfolio    = $unsplash->portfolio($username);                    // single user's portfolio
$photos       = $unsplash->photos($username, $params)->get();       // single user's photos
$photos       = $unsplash->likes($username, $params)->get();        // single user's likes
$collections  = $unsplash->collections($username, $params)->get();  // single user's collections
$statistics   = $unsplash->statistics($username, $params)->get();   // single user's statistics
 php
$unsplash    = new Scottybo\LaravelUnsplash\Collection();
$collection  = $unsplash->collections($params)->get(); // list of all collections
$collection  = $unsplash->single($id)->get(); // single collections
$photos      = $unsplash->photos($id, $params)->get(); // collection photos
$statistic   = $unsplash->statistic($id, $params)->get(); // single collections statistics
$collection  = $unsplash->curated($params)->get(); // list of curated collections
$collection  = $unsplash->related($id)->get(); // list of related collections
$collection  = $unsplash->featured($params)->get(); // list of featured collections
 php
$unsplash   = new Scottybo\LaravelUnsplash\Search();
$photos     = $unsplash->photo($query, $params)->get();
$collection = $unsplash->collection($query, $params)->get();
$user       = $unsplash->user($query, $params)->get();