laravel-image-oxide maintained by haidarrais
haidarrais/laravel-image-oxide
Laravel bridge over haidarrais/image-oxide:
auto-discovered service provider, publishable config, Oxide facade, an
Intervention-compatible shim, and Storage::oxideResize disk macros.
Spec 005 of the image-oxide project. The Rust daemon + PHP client live in haidarrais/image-oxide.
Requirements
- PHP >= 8.2, Laravel 10 / 11 / 12
haidarrais/image-oxide(installed automatically)
Install
composer require haidarrais/laravel-image-oxide
The provider is auto-discovered. Publish the config when you want to tweak it:
php artisan vendor:publish --tag=image-oxide-config
Config
config/image-oxide.php:
| Key | Default | Purpose |
|---|---|---|
driver |
auto |
daemon, gd, or auto (daemon when reachable, else GD) |
daemon.binary |
image-oxide |
path to the Rust daemon executable |
daemon.timeout_ms |
30000 |
per round-trip timeout |
queue.capacity |
32 |
daemon request queue |
disk |
local |
default disk for the storage macros |
Usage
Oxide facade
use Haidarrais\LaravelImageOxide\Facades\Oxide;
Oxide::image('/path/to/in.png')
->resize(800, 600, 'cover')
->format('webp')
->quality(85)
->to('/path/to/out.webp');
Storage macros
Resize an object on any disk (local, s3, gcs, Storage::fake()):
use Illuminate\Support\Facades\Storage;
Storage::disk('s3')->oxideResize('photos/in.png', 800, 600, 'webp');
The macro downloads to a temp file, runs the op chain, pushes the result back, and
cleans up in a finally — a failed op leaves no partial remote object.
Intervention-compatible shim
A drop-in subset of the Intervention facade. resize(), encode(), rotate(),
insert(), quality(), save(), get(), response() are mapped; anything else
throws UnsupportedOperationException (LV-07).
use Haidarrais\LaravelImageOxide\Facades\Image;
Image::make('/in.png')
->resize(800, 600, fn ($c) => $c->aspectRatio())
->encode('webp')
->save('/out.webp');
Tests
composer install
composer test
The suite covers the provider/config (LV-01–LV-03), disk macros (LV-04–LV-05),
and the shim (LV-06–LV-07) against Storage::fake() and the GD driver.
License
MIT — see LICENSE.