PHPackages                             gabrielesbaiz/unsplash-toolkit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. gabrielesbaiz/unsplash-toolkit

ActiveLibrary[Image &amp; Media](/categories/media)

gabrielesbaiz/unsplash-toolkit
==============================

A lightweight helper package to handle Unsplash photos

1.1.1(1y ago)02.4k↑850%MITPHPPHP ^7.3,^8.0|^8.1|^8.2|^8.3|^8.4CI failing

Since Mar 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/gabrielesbaiz/unsplash-toolkit)[ Packagist](https://packagist.org/packages/gabrielesbaiz/unsplash-toolkit)[ Docs](https://github.com/gabrielesbaiz/unsplash-toolkit)[ GitHub Sponsors]()[ RSS](/packages/gabrielesbaiz-unsplash-toolkit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (10)Versions (5)Used By (0)

UnsplashToolkit
===============

[](#unsplashtoolkit)

[![Latest Version on Packagist](https://camo.githubusercontent.com/40010ef283191fb654867d6443290b93671be4b2f6d4175a1e1d92e6c68546e9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6761627269656c65736261697a2f756e73706c6173682d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gabrielesbaiz/unsplash-toolkit)[![Total Downloads](https://camo.githubusercontent.com/5801c4bb34f92662d897693575b648ffec800e0c179411cd131a0d5941ff6766/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6761627269656c65736261697a2f756e73706c6173682d746f6f6c6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gabrielesbaiz/unsplash-toolkit)

A lightweight helper package to handle Unsplash photos

Original code from [marksitko/laravel-unsplash](https://github.com/marksitko/laravel-unsplash)

Features
--------

[](#features)

- ✅ Fluent api to use the Unsplash within Laravel applications
- ✅ Works seamlessly with Laravel facades

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require gabrielesbaiz/unsplash-toolkit
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="unsplash-toolkit-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="unsplash-toolkit-config"
```

This is the contents of the published config file:

```
return [
    'access_key' => env('UNSPLASH_ACCESS_KEY'),
    'store_in_database' => env('UNSPLASH_STORE_IN_DATABASE', false),
    'disk' => env('UNSPLASH_STORAGE_DISK', 'local'),
    'app_name' => env('UNSPLASH_APP_NAME', 'your_app_name'),
];
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

Take a look at the full Unsplash API documentation

**Random Photos**

```
// Returns the http response body.
$twoRandomPhotosOfSomePeoples = UnsplashToolkit::randomPhoto()
    ->orientation('portrait')
    ->term('people')
    ->count(2)
    ->toJson();

// Store the image in on your provided disc
$theNameFromTheStoredPhoto = UnsplashToolkit::randomPhoto()
    ->orientation('landscape')
    ->term('music')
    ->randomPhoto()
    ->store();
];
```

**Photos**

```
$photos = UnsplashToolkit::photos()->toJson();
$photo = UnsplashToolkit::photo($id)->toJson();
$photosStatistics = UnsplashToolkit::photosStatistics($id)->toJson();
$trackPhotoDownload = UnsplashToolkit::trackPhotoDownload($id)->toJson();
```

**Users**

```
$user = UnsplashToolkit::user($username)->toJson();
$userPortfolio = UnsplashToolkit::userPortfolio($username)->toJson();
$userPhotos = UnsplashToolkit::userPhotos($username)->toJson();
$userLikes = UnsplashToolkit::userLikes($username)->toJson();
$userCollections = UnsplashToolkit::userCollections($username)->toJson();
$userStatistics = UnsplashToolkit::userStatistics($username)->toJson();
```

**Search**

```
$search = UnsplashToolkit::search()
    ->term('buildings')
    ->color('black_and_white')
    ->orientation('squarish')
    ->toJson();

$searchCollections = UnsplashToolkit::searchCollections()
    ->query('events')
    ->page($pageNumber)
    ->toJson();

$searchUsers = UnsplashToolkit::searchUsers()
    ->query('search_term')
    ->toJson();
```

**Collections**

```
$collectionsList = UnsplashToolkit::collectionsList()
    ->page($pageNumber)
    ->perPage($itemsPerPage)
    ->toJson();

$featuredCollection = UnsplashToolkit::featuredCollection()
    ->page($pageNumber)
    ->perPage($itemsPerPage)
    ->toJson();

$showCollection = UnsplashToolkit::showCollection()
    ->id($collectionId)
    ->toJson();

$showCollectionPhotos = UnsplashToolkit::showCollectionPhotos()
    ->id($collectionId)
    ->toJson();

$showCollectionRelatedCollections = UnsplashToolkit::showCollectionRelatedCollections()
    ->id($collectionId)
    ->toJson();
```

**Stats**

```
$totalStats = UnsplashToolkit::totalStats()->toJson();
$monthlyStats = UnsplashToolkit::monthlyStats()->toJson();
```

### Usage with Database

[](#usage-with-database)

If you wanna persist automaticly some informations (i.e. Copyrights) about you stored images you have to run the published migrations.

Set the `.env` variable

```
UNSPLASH_STORE_IN_DATABASE=true

```

When you execute `store()`, the image is stored in your provided disc and informations like

- the unsplash photo id
- the stored image name
- author name
- author link

Note that these informations are all required to use a Unsplash photo on your website.

### Trait

[](#trait)

You can also use the `HasUnsplashables` Trait on any model.

**Example with HasUnsplashables Trait on the User Model**

```
use Illuminate\Foundation\Auth\User as Authenticatable;

use Gabrielesbaiz\UnsplashToolkit\Traits\HasUnsplashables;

class User extends Authenticatable
{
    use HasUnsplashables;

    // ...
}
```

Now you are able to use it like:

```
// store the unsplash asset in a morphToMany relation
$unsplashAsset = UnsplashToolkit::randomPhoto()->store();

User::unsplash()->save($unsplashAsset);

// retrive all related unsplash assets
User::find($userId)->unsplash();
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mark Sitko](https://github.com/marksitko)
- [Gabriele Sbaiz](https://github.com/gabrielesbaiz)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance44

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

441d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/97040fb60637d4b81897347524bc9343ffa6b978d4b19c0c28ea0823e2a1752b?d=identicon)[gabrielesbaiz](/maintainers/gabrielesbaiz)

---

Top Contributors

[![gabrielesbaiz](https://avatars.githubusercontent.com/u/22818698?v=4)](https://github.com/gabrielesbaiz "gabrielesbaiz (5 commits)")

---

Tags

laravel-packagephplaravelGabriele Sbaizunsplash-toolkit

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/gabrielesbaiz-unsplash-toolkit/health.svg)

```
[![Health](https://phpackages.com/badges/gabrielesbaiz-unsplash-toolkit/health.svg)](https://phpackages.com/packages/gabrielesbaiz-unsplash-toolkit)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[saasykit/laravel-open-graphy

An awesome open graph image (social cards) generator package for Laravel.

13057.0k](/packages/saasykit-laravel-open-graphy)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[ace-of-aces/laravel-image-transform-url

Easy, URL-based image transformations inspired by Cloudflare Images.

1756.4k](/packages/ace-of-aces-laravel-image-transform-url)[spatie/laravel-mailcoach-sdk

An SDK to easily work with the Mailcoach API in Laravel apps

41290.2k1](/packages/spatie-laravel-mailcoach-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
