PHPackages                             apsonex/laravel-stock-image - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. apsonex/laravel-stock-image

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

apsonex/laravel-stock-image
===========================

Stock Images

1.0.3(10mo ago)040MITPHPPHP ^8.2

Since Jun 16Pushed 10mo agoCompare

[ Source](https://github.com/apsonex/laravel-stock-image)[ Packagist](https://packagist.org/packages/apsonex/laravel-stock-image)[ Docs](https://github.com/apsonex/laravel-stock-image)[ RSS](/packages/apsonex-laravel-stock-image/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Stock Image
===================

[](#laravel-stock-image)

**Laravel Stock Image** is a pluggable image search API tool that allows you to query stock images from various providers like **Unsplash**, **Pexels**, **Pixabay**, and also generate placeholder images dynamically.

---

🚀 Features
----------

[](#-features)

- Supports multiple providers: Unsplash, Pexels, Pixabay, Placeholder
- Custom API keys per request or config
- Smart keyword fallback mechanism
- Random image selection and provider rotation
- Easy Laravel integration with route and controller
- Fully testable and extendable architecture

---

📦 Installation
--------------

[](#-installation)

```
composer require apsonex/laravel-stock-image
```

If you're using Laravel 10+, package auto-discovery will register everything automatically.

---

⚙️ Configuration
----------------

[](#️-configuration)

Publish the configuration file if needed:

```
php artisan vendor:publish --tag=laravel-stock-image-config
```

This will create `config/stock-image.php`:

```
return [
    'route' => [
        'enable'     => true,
        'path'       => 'api/ai/tools/stock-images/search',
        'middleware' => [
            // middlewares
        ],
    ],
];
```

---

🔌 Routing
---------

[](#-routing)

The package automatically registers this route when enabled in the config:

```
POST /stock-image-search

```

### Payload Parameters

[](#payload-parameters)

KeyTypeDescription`keywords``string`Comma-separated keywords to search images (required)`random_result``boolean`Whether to return a random image from results`random_provider``boolean`Whether to pick a random provider`page``int`Which page to fetch from provider`cache``boolean`Whether to cache the result (default: false)`result_limit``int`Limit number of images result`provider_api_keys``array`Optional - Override API keys per provider (optional)`placeholder_size``string`Used only when fallback placeholder is returned e.g. `600x400``placeholder_text``string`Text to show in placeholder image e.g. `Sample Text``placeholder_text_color``string`Color for placeholder text e.g. `#000000``placeholder_bg_color``string`Background color for placeholder e.g. `#cccccc`---

### ✅ Example Request (JSON)

[](#-example-request-json)

`POST` to `/api/ai/tools/stock-images/search`

```
// result
{
  "keywords": "mountain, beach",
  "random_result": true,
  "random_provider": false,
  "page": 1,
  "cache": false,
  "result_limit": 10,
  "provider_api_keys": {
    "pexels": "",
    "unsplash": "",
    "pixabay": ""
  },
  "placeholder_text": "Placeholder Image",
  "placeholder_size": "600x400",
  "placeholder_bg_color": "cccccc",
  "placeholder_text_color": "333333"
}
```

---

🔄 Sample JSON Response
----------------------

[](#-sample-json-response)

```
{
  "items": [
    {
      "image_url": "https://example.com/image.jpg",
      "image_description": "A stunning mountain landscape",
      "source": "unsplash"
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 30,
    "count": 1
  },
  "status": "success"
}
```

---

🧪 Testing
---------

[](#-testing)

You can run tests using Pest:

```
./vendor/bin/pest
```

Make sure to mock external APIs to avoid hitting rate limits.

---

🧠 License
---------

[](#-license)

MIT © [Apsonex](https://apsonex.com)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance53

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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

329d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c01c7781cf9e16fbd9358743e58a0d1bf5802d5059d3b5245daf3165f7ceb06e?d=identicon)[apsonex](/maintainers/apsonex)

---

Top Contributors

[![gurindersingh](https://avatars.githubusercontent.com/u/6223752?v=4)](https://github.com/gurindersingh "gurindersingh (12 commits)")

---

Tags

laravelapsonexlaravel-stock-image

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/apsonex-laravel-stock-image/health.svg)

```
[![Health](https://phpackages.com/badges/apsonex-laravel-stock-image/health.svg)](https://phpackages.com/packages/apsonex-laravel-stock-image)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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