Download the PHP package apsonex/laravel-stock-image without Composer
On this page you can find all versions of the php package apsonex/laravel-stock-image. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download apsonex/laravel-stock-image
More information about apsonex/laravel-stock-image
Files in apsonex/laravel-stock-image
Package laravel-stock-image
Short Description Stock Images
License MIT
Homepage https://github.com/apsonex/laravel-stock-image
Informations about the package 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
- 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
If you're using Laravel 10+, package auto-discovery will register everything automatically.
โ๏ธ Configuration
Publish the configuration file if needed:
This will create config/stock-image.php
:
๐ Routing
The package automatically registers this route when enabled in the config:
Payload Parameters
Key | Type | Description |
---|---|---|
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)
POST
to /api/ai/tools/stock-images/search
๐ Sample JSON Response
๐งช Testing
You can run tests using Pest:
Make sure to mock external APIs to avoid hitting rate limits.
๐ง License
MIT ยฉ Apsonex
All versions of laravel-stock-image with dependencies
illuminate/contracts Version ^10.0||^11.0||^12.0
spatie/invade Version ^2.1
spatie/laravel-package-tools Version ^1.16