PHP code example of arcasolutions / unsplash

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

    

arcasolutions / unsplash example snippets


Crew\Unsplash\HttpClient::init([
	'applicationId'	=> 'YOUR APPLICATION ID',
	'secret'		=> 'YOUR APPLICATION SECRET',
	'callbackUrl'	=> 'https://your-application.com/oauth/callback',
	'utmSource' => 'NAME OF YOUR APPLICATION'
]);

$scopes = ['public', 'write_user'];
Crew\Unsplash\HttpClient::$connection->getConnectionUrl($scopes);

Crew\Unsplash\HttpClient::$connection->generateToken($code);

$filters  = [
    'query' => 'Some query',
    'page' => 3,
    'per_page' => 15,
    'orientation' => 'landscape'
];

Crew\Unsplash\Search::photos($filters);

$filters  = [
    'query' => 'Some query',
    'page' => 3,
    'per_page' => 15,
];

Crew\Unsplash\Search::collections($filters);

$filters  = [
    'query' => 'Some query',
    'page' => 3,
    'per_page' => 15,
];

Crew\Unsplash\Search::users($filters);

$filters  = [
    'page' => 3,
    'per_page' => 15,
];

Crew\Unsplash\CuratedCollection::all($page, $per_page);

Crew\Unsplash\CuratedCollection::all($page, $per_page, false);

Crew\Unsplash\CuratedCollection::find(integer $id);

$collection = Crew\Unsplash\CuratedCollection::find(integer $id);
$photos = $collection->photos();

$collection = Crew\Unsplash\CuratedCollection::find(integer $id);
$photos = $collection->photos(false);

$filters  = [
    'page' => 3,
    'per_page' => 15,
];


Crew\Unsplash\Collection::all($filters);

Crew\Unsplash\Collection::all($filters, false);

$filters  = [
    'page' => 3,
    'per_page' => 15,
];


Crew\Unsplash\Collection::featured($filters);

Crew\Unsplash\Collection::featured($filters, false);

$collection = Crew\Unsplash\Collection::find($id);
$collection->related();

$collection = Crew\Unsplash\Collection::find($id);
$collection->related(false);

Crew\Unsplash\Collection::find(integer $id);

$filters  = [
    'page' => 3,
    'per_page' => 15,
];

$collection = Crew\Unsplash\Collection::find(integer $id);
$photos = $collection->photos($filters);

$filters  = [
    'page' => 3,
    'per_page' => 15,
];

$collection = Crew\Unsplash\Collection::find(integer $id);
$photos = $collection->photos($filters, false);

$collection = Crew\Unsplash\Collection::create($title);

$collection = Crew\Unsplash\Collection::find(int $id);
$collection->update(['private' => true])

$collection = Crew\Unsplash\Collection::find(int $id);
$collection->destroy()

$collection = Crew\Unsplash\Collection::find(int $id);
$collection->add(int $photo_id)

$collection = Crew\Unsplash\Collection::find(int $id);
$collection->remove(int $photo_id)

$filters  = [
    'page' => 3,
    'per_page' => 15,
    'order_by' => 'latest',
];

Crew\Unsplash\Photo::all($filters);

$filters  = [
    'page' => 3,
    'per_page' => 15,
    'order_by' => 'latest',
];

Crew\Unsplash\Photo::all($filters, false);

$filters  = [
    'page' => 3,
    'per_page' => 15,
    'order_by' => 'latest',
];

Crew\Unsplash\Photo::curated($page, $per_page, $order_by);

$filters  = [
    'page' => 3,
    'per_page' => 15,
    'order_by' => 'latest',
];

Crew\Unsplash\Photo::curated($page, $per_page, $order_by, false);

Crew\Unsplash\Photo::find($id);

Crew\Unsplash\Photo::create( $file_path);

$photo = Crew\Unsplash\Photo::find(string $id)
$photo->update(array $parameters);

$photo = Crew\Unsplash\Photo::find(string $id);
$photo->photographer();


// Or apply some optional filters by passing a key value array of filters
$filters = [
    'featured' => true,
    'username' => 'andy_brunner',
    'query'    => 'coffee',
];

Crew\Unsplash\Photo::random($filters);

$photo = Crew\Unsplash\Photo::find(string $id);
$photo->like();

$photo = Crew\Unsplash\Photo::find(string $id);
$photo->unlike();



$photo = Crew\Unsplash\Photo::find($id);
$photo->statistics('days', 7);

$photo = Crew\Unsplash\Photo::find();
$photo->download();

Crew\Unsplash\User::find($username)

Crew\Unsplash\User::portfolio($username)

$user = Crew\Unsplash\User::current();

$filters  = [
    'page' => 3,
    'per_page' => 15,
    'order_by' => 'latest',
];

$user = Crew\Unsplash\User::find($username);
$user->photos($filters);

$filters  = [
    'page' => 3,
    'per_page' => 15,
    'order_by' => 'latest',
];

$user = Crew\Unsplash\User::find($username);
$user->collections($filters);

$user = Crew\Unsplash\User::find($username);
$user->likes($page, $per_page, $order_by);

$user = Crew\Unsplash\User::current();
$user->update(['first_name' => 'Elliot', 'last_name' => 'Alderson']);

$user = Crew\Unsplash\User::find($id);
$user->statistics('days', 7);