PHP code example of simonbarrettact / unsplash

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

    

simonbarrettact / unsplash example snippets


return [
    // ...

    'unsplash' => [
        'access_key' => env('UNSPLASH_ACCESS_KEY')
    ],

];

/** * Run the migrations. 
 * 
 * @return void 
 */
 public function up()
 {    
     Schema::table('my_table', function (Blueprint $table) {
        $table->string('unsplash_id', 20);
     });
 }

use SimonBarrettACT\Unsplash\Unsplash;
...
public function fields(Request $request) {
    return [
        ...
            Unsplash::make('Photo', 'unsplash_id'),
        ...
    ];
}          

Unsplash::make('Photo', 'unsplash_id')
   ->queryPlaceholder('Provide a topic to search for') //Optional
   ->orientation('landscape') //Optional - landscape, portrait or squarish
   ->previewSize('regular')   //Optional - thumb, small, regular, full
   ->featured(true),          //Optional - set to true to only display 'featured' images