2017 © Pedro PelĂĄez
 

library unsplash

Unofficial PHP wrapper to access the Unsplash API

image

diza/unsplash

Unofficial PHP wrapper to access the Unsplash API

  • Sunday, June 18, 2017
  • by taduuda
  • Repository
  • 1 Watchers
  • 0 Stars
  • 74 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 17 % Grown

The README.md

unsplash-php

An unofficial PHP wrapper to access the Unsplash API, focused on API call efficiency and ease of use., (*1)

Note: This wrapper only supports public actions., (*2)

Installation

Unsplash-PHP uses Composer. To use it, require the library, (*3)

composer require cetteup/unsplash

Usage

Configuration

Before you can start making calls to the API, you need to configure the client with your application ID., (*4)

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

API methods

Please refer to the official documentation for more detailed information on the response structures., (*5)

Cetteup\Unsplash\HttpClient->user_find($username)

Retrieve public details on a given user., (*6)

Note: You need to instantiate an httpclient object first, (*7)

Arguments, (*8)

Argument Type Opt/Required
$username string Required

Example, (*9)

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

Cetteup\Unsplash\HttpClient->user_portfolio_link($username)

Retrieve a single user’s portfolio link., (*10)

Note: You need to instantiate an httpclient object first, (*11)

Arguments, (*12)

Argument Type Opt/Required
$username string Required

Example, (*13)

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

Cetteup\Unsplash\HttpClient->user_photos($username, $page, $per_page, $order_by, $stats, $resolution, $quantity, $orientation)

Get a list of photos uploaded by a user., (*14)

Note: You need to instantiate an httpclient object first, (*15)

Arguments, (*16)

Argument Type Opt/Required Note
$username string Required
$page int Opt (Default: 1)
$per_page int Opt (Default: 10 / Maximum: 30)
$order_by string Opt (Default: latest) Accepted values: latest, oldest, popular
$stats bool Opt (Default: false)
$resolution string Opt (Default: days) Accepted values: days
$quantity int Opt (Default: 30)
$orientation string Opt Accepted values: landscape, portrait, squarish

Example, (*17)

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

Cetteup\Unsplash\HttpClient->user_likes($username, $page, $per_page, $order_by, $orientation)

Get a list of photos liked by a user., (*18)

Note: You need to instantiate an httpclient object first, (*19)

Arguments, (*20)

Argument Type Opt/Required Note
$username string Required
$page int Opt (Default: 1)
$per_page int Opt (Default: 10 / Maximum: 30)
$order_by string Opt (Default: latest) Accepted values: latest, oldest, popular
$orientation string Opt Accepted values: landscape, portrait, squarish

Example, (*21)

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

Cetteup\Unsplash\HttpClient->user_collections($username, $page, $per_page)

Get a list of collections created by a user., (*22)

Note: You need to instantiate an httpclient object first, (*23)

Arguments, (*24)

Argument Type Opt/Required
$username string Required
$page int Opt (Default: 1)
$per_page int Opt (Default: 10 / Maximum: 30)

Example, (*25)

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

Cetteup\Unsplash\HttpClient->user_statistics($username, $resolution, $quantity)

Retrieve the consolidated number of downloads, views and likes of all user’s photos, as well as the historical breakdown and average of these stats in a specific timeframe., (*26)

Note: You need to instantiate an httpclient object first, (*27)

Arguments, (*28)

Argument Type Opt/Required Note
$username string Required
$resolution string Opt (Default: days) Accepted values: days
$quantity int Opt (Default: 30 / Minimum: 1 / Maximum: 30)

Example, (*29)

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

Cetteup\Unsplash\HttpClient->photo_all($page, $per_page, $order_by)

Get a single page from the list of all photos., (*30)

Note: You need to instantiate an httpclient object first, (*31)

Arguments, (*32)

Argument Type Opt/Required Note
$page int Opt (Default: 1)
$per_page int Opt (Default: 10 / Maximum: 30)
$order_by string Opt (Default: latest) Accepted values: latest, oldest, popular

Example, (*33)

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

Cetteup\Unsplash\HttpClient->photo_find($id)

Retrieve a single photo., (*34)

Note: You need to instantiate an httpclient object first, (*35)

Arguments, (*36)

Argument Type Opt/Required
$id string Required

Example, (*37)

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

Cetteup\Unsplash\HttpClient->photo_random($params)

Retrieve a single random photo, given optional filters., (*38)

Note: You need to instantiate an httpclient object first, (*39)

Arguments, (*40)

Argument Type Opt/Required
$params array Opt

Example, (*41)

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

Cetteup\Unsplash\HttpClient->photo_statistics($id, $resolution, $quantity)

Retrieve total number of downloads, views and likes of a single photo, as well as the historical breakdown of these stats in a specific timeframe., (*42)

Note: You need to instantiate an httpclient object first, (*43)

Arguments, (*44)

Argument Type Opt/Required Note
$id string Required
$resolution string Opt (Default: days) Accepted values: days
$quantity int Opt (Default: 30 / Minimum: 1 / Maximum: 30)

Example, (*45)

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

Cetteup\Unsplash\HttpClient->photo_download($id)

Track a photo download., (*46)

Note: You need to instantiate an httpclient object first, (*47)

Arguments, (*48)

Argument Type Opt/Required
$id string Required

Example, (*49)

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

Cetteup\Unsplash\HttpClient->search_photos($search, $page, $per_page, $order_by, $content_filter, $collections, $color, $orientation)

Get a single page of photo results for a query., (*50)

Note: You need to instantiate an httpclient object first, (*51)

Arguments, (*52)

Argument Type Opt/Required Note
$search string Required Multiple search terms need to be separated by , , or +
$page int Opt (Default: 1)
$per_page int Opt (Default: 10 / Maximum: 30)
$order_by string Opt (Default: relevant) Accepted values: latest, relevant
$content_filter string Opt (Default: low) Accepted values: low, high
$collections string Opt Multiple IDs need to be comma-separated
$color string Opt Accepted values: black_and_white, black, white, yellow, orange, red, purple, magenta, green, teal, and blueblack_and_white, black, white, yellow, orange, red, purple, magenta, green, teal, blue
$orientation string Opt Accepted values: landscape, portrait, squarish

Example, (*53)

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

Cetteup\Unsplash\HttpClient->search_collections($search, $page, $per_page)

Get a single page of collection results for a query., (*54)

Note: You need to instantiate an httpclient object first, (*55)

Arguments, (*56)

Argument Type Opt/Required Note
$search string Required Multiple search terms need to be separated by , , or +
$page int Opt (Default: 1)
$per_page int Opt (Default: 10 / Maximum: 30)

Example, (*57)

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

Cetteup\Unsplash\HttpClient->search_users($search, $page, $per_page)

Get a single page of user results for a query., (*58)

Note: You need to instantiate an httpclient object first, (*59)

Arguments, (*60)

Argument Type Opt/Required Note
$search string Required Multiple search terms need to be separated by , , or +
$page int Opt (Default: 1)
$per_page int Opt (Default: 10 / Maximum: 30)

Example, (*61)

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

Cetteup\Unsplash\HttpClient->collection_all($page, $per_page)

Get a single page from the list of all collections., (*62)

Note: You need to instantiate an httpclient object first, (*63)

Arguments, (*64)

Argument Type Opt/Required
$page int Opt (Default: 1)
$per_page int Opt (Default: 10 / Maximum: 30)

Example, (*65)

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

Cetteup\Unsplash\HttpClient->collection_featured($page, $per_page)

Get a single page from the list of featured collections., (*66)

Note: You need to instantiate an httpclient object first, (*67)

Arguments, (*68)

Argument Type Opt/Required
$page int Opt (Default: 1)
$per_page int Opt (Default: 10 / Maximum: 30)

Example, (*69)

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

Cetteup\Unsplash\HttpClient->collection_find($id)

Retrieve a single collection., (*70)

Note: You need to instantiate an httpclient object first, (*71)

Arguments, (*72)

Argument Type Opt/Required Note
$id int Required

Example, (*73)

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

Cetteup\Unsplash\HttpClient->collection_photos($id, $page, $per_page, $orientation)

Retrieve a collection’s photos., (*74)

Note: You need to instantiate an httpclient object first, (*75)

Arguments, (*76)

Argument Type Opt/Required Note
$id int Required
$page int Opt (Default: 1)
$per_page int Opt (Default: 10 / Maximum: 30)
$orientation string Opt Accepted values: landscape, portrait, squarish

Example, (*77)

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

Cetteup\Unsplash\HttpClient->collection_related($id)

Retrieve a list of related collections., (*78)

Note: You need to instantiate an httpclient object first, (*79)

Arguments, (*80)

Argument Type Opt/Required
$id int Required

Example, (*81)

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

Cetteup\Unsplash\HttpClient->stats_total()

Get a list of stats for all of Unsplash., (*82)

Note: You need to instantiate an httpclient object first, (*83)

Example, (*84)

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

Cetteup\Unsplash\HttpClient->stats_month()

Get the overall Unsplash stats for the past 30 days., (*85)

Note: You need to instantiate an httpclient object first, (*86)

Example, (*87)

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

The Versions

18/06 2017

dev-master

9999999-dev

Unofficial PHP wrapper to access the Unsplash API

  Sources   Download

MIT

The Requires

 

The Development Requires

18/06 2017

v1.0.1

1.0.1.0

Unofficial PHP wrapper to access the Unsplash API

  Sources   Download

MIT

The Requires

 

The Development Requires

16/01 2017

v1.0

1.0.0.0

Unofficial PHP wrapper to access the Unsplash API

  Sources   Download

MIT

The Requires

 

The Development Requires