PHP code example of cetteup / unsplash

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

    

cetteup / unsplash example snippets


$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$user = $unsplash->user_find('cetteup');

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$link = $unsplash->user_portfolio_link('cetteup');

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$photos = $unsplash->user_photos('cetteup', 2, 30, 'oldest');

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$photos = $unsplash->user_likes('cetteup', 2, 20, 'popular');

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$collections = $unsplash->user_collections('jlantunez', 3, 5);

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$collections = $unsplash->user_statistics('cetteup', 'days', 10);

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$photos = $unsplash->photo_all(2, 30, 'oldest');

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$photo = $unsplash->photo_find('54t5rivyAiI');

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$photo = $unsplash->photo_random(['orientation' => 'portrait']);

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$stats = $unsplash->photo_statistics('54t5rivyAiI', 'days', 14);

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$unsplash->photo_download('54t5rivyAiI');

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$results = $unsplash->search_photos('cats', 5, 30);

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$results = $unsplash->search_collections('dogs', 10, 25);

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$results = $unsplash->search_users('photography', 1, 15);

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$collections = $unsplash->collection_all(10, 30);

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$collections = $unsplash->collection_featured(2, 10);

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$collection = $unsplash->collection_find(1121542);

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$photos = $unsplash->collection_photos(1121542, 1, 10, 'squarish');

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$collections = $unsplash->collection_related(1121542);

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$stats = $unsplash->stats_total();

$unsplash = new Cetteup\Unsplash\HttpClient('YOUR APPLICATION ID');
$stats = $unsplash->stats_month();