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)09.0k↑7041.7%[1 PRs](https://github.com/gabrielesbaiz/unsplash-toolkit/pulls)MITPHPPHP ^7.3,^8.0|^8.1|^8.2|^8.3|^8.4CI failing

Since Mar 2Pushed 2mo 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 2d ago

READMEChangelog (4)Dependencies (10)Versions (6)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

43

—

FairBetter than 89% of packages

Maintenance65

Regular maintenance activity

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

487d 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

87512.0M164](/packages/spatie-laravel-health)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[nativephp/mobile

NativePHP for Mobile

1.1k75.1k91](/packages/nativephp-mobile)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

44855.7k](/packages/harris21-laravel-fuse)

PHPackages © 2026

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