2017 © Pedro Peláez
 

library laravel-unsplash-wrapper

A Laravel wrapper for Unsplash

image

shweshi/laravel-unsplash-wrapper

A Laravel wrapper for Unsplash

  • Tuesday, July 31, 2018
  • by imspg
  • Repository
  • 0 Watchers
  • 1 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 4 % Grown

The README.md

LaravelUnsplashWrapper

Latest Version on Packagist Scrutinizer Code Quality StyleCI Build Status Total Downloads FOSSA Status, (*1)

A Laravel wrapper for Unsplash., (*2)

Install

Via Composer, (*3)

``` bash $ composer require shweshi/laravel-unsplash-wrapper, (*4)

If you do not run Laravel 5.5 (or higher), then add the service provider in config/app.php:

shweshi\LaravelUnsplashWrapper\Providers\UnsplashServiceProvider::class, shweshi\LaravelUnsplashWrapper\Providers\UnsplashSearchServiceProvider::class, shweshi\LaravelUnsplashWrapper\Providers\UnsplashUsersServiceProvider::class, shweshi\LaravelUnsplashWrapper\Providers\UnsplashPhotosServiceProvider::class, shweshi\LaravelUnsplashWrapper\Providers\UnsplashCollectionsServiceProvider::class,, (*5)


If you do run the package on Laravel 5.5+, package auto-discovery takes care of the magic of adding the service provider. Next under the alias array in config/app.php add

'UnsplashSearch' => shweshi\LaravelUnsplashWrapper\Facades\UnsplashSearchFacade::class, 'UnsplashUsers' => shweshi\LaravelUnsplashWrapper\Facades\UnsplashUsersFacade::class, 'UnsplashPhotos' => shweshi\LaravelUnsplashWrapper\Facades\UnsplashPhotosFacade::class, 'UnsplashCollections' => shweshi\LaravelUnsplashWrapper\Facades\UnsplashCollectionsFacade::class,, (*6)


You must publish the configuration to provide your own service provider stub. ``` bash $ php artisan vendor:publish --provider="shweshi\LaravelUnsplashWrapper\Providers\UnsplashServiceProvider"

Update your settings in the generated app/config/unsplash.php configuration file., (*7)

return [
    'ApplicationID' => 'YOUR APPLICATION ACCES KEY HERE',
];

Usage

See documention for params and others at unsplash docs, (*8)

List of methods:, (*9)

Photos

``` php, (*10)

$photos = UnsplashPhotos::photos([]); // list of all photos $photo = UnsplashPhotos::single($id, $params); // single photo $statistic = UnsplashPhotos::statistic($id, $params); // single photo statistics $downloadUrl = UnsplashPhotos::download($id, $params); // single photo download link $curatedPhotos = UnsplashPhotos::curated($params); // list of curated photos $randomPhoto = UnsplashPhotos::random($params); // random photo, (*11)


### Users ``` php use UnsplashUsers; $user = UnsplashUsers::profile($username, $params); // single user $portfolio = UnsplashUsers::portfolio($username); // single user's portfolio $photos = UnsplashUsers::photos($username, $params); // single user's photos $photos = UnsplashUsers::likes($username, $params); // single user's likes $collections = UnsplashUsers::collections($username, $params); // single user's collections $statistics = UnsplashUsers::statistics($username, $params); // single user's statistics

Collections

``` php use UnsplashCollections;, (*12)

$collection = UnsplashCollections::collections($params); // list of all collections $collection = UnsplashCollections::single($id, $params); // single collections $photos = UnsplashCollections::photos($id, $params); // collection photos $statistic = UnsplashCollections::statistic($id, $params); // single collections statistics $collection = UnsplashCollections::curated($params); // list of curated collections $collection = UnsplashCollections::related($id, $params); // list of related collections $collection = UnsplashCollections::featured($params); // list of featured collections, (*13)


### Search ``` php use UnsplashSearch; $photos = UnsplashSearch::photo($query, $params); $collection = UnsplashSearch::collection($query, $params); $user = UnsplashSearch::user($query, $params);

Example

echo UnsplashPhotos::photos(['page' => 1, 'order_by' => 'oldest']);, (*14)

will get you something like, (*15)

ixlib=rb-0.3.5\u0026q=80\u0026fm=jpg\u0026crop=faces\u0026cs=tinysrgb\u0026fit=crop\u0026h=64\u0026w=64\u0026s=4ddd6656ddd74206872f45c033371087","large":"https://images.unsplash.com/profile-1441298310363-3eb4b1feb829?
.....

which you will need to format, (*16)

Contributing

Please see CONTRIBUTING and CODE OF CONDUCT for details., (*17)

License

FOSSA Status, (*18)

Support

Buy Me A Coffee, (*19)

Happy Coding!

The Versions

31/07 2018

dev-master

9999999-dev

A Laravel wrapper for Unsplash

  Sources   Download

MIT

The Requires

 

by Shashi Prakash Gautam

10/02 2018

3.0.0

3.0.0.0

A Laravel wrapper for Unsplash

  Sources   Download

MIT

The Requires

 

by Shashi Prakash Gautam

10/02 2018

2.0.0

2.0.0.0

A Laravel wrapper for Unsplash

  Sources   Download

MIT

The Requires

 

by Shashi Prakash Gautam

10/02 2018

1.0.2

1.0.2.0

A Laravel wrapper for Unsplash

  Sources   Download

MIT

by Shashi Prakash Gautam

10/02 2018

1.0.1

1.0.1.0

A Laravel wrapper for Unsplash

  Sources   Download

MIT

by Shashi Prakash Gautam

10/02 2018

1.0.0

1.0.0.0

A Laravel wrapper for Unsplash

  Sources   Download

MIT

by Shashi Prakash Gautam