imgsrc / laravel
The official Laravel client for ImgSrc — real-time image processing, uploads, and delivery for Laravel apps.
Requires
- php: ^8.2
- illuminate/http: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- illuminate/view: ^11.0|^12.0|^13.0
This package is not auto-updated.
Last update: 2026-08-02 21:14:31 UTC
README
The official Laravel client for ImgSrc — real-time image processing, uploads, and delivery, laser-focused on Laravel.
Installation
composer require imgsrc/laravel
Add your credentials to .env:
# Where your images are served from (your source subdomain or custom domain) IMGSRC_URL=https://my-app.imgsrc.test # Only needed when your source has Secure URLs enabled IMGSRC_TOKEN= # Management API (uploads, deletes, purges) — from your ImgSrc dashboard IMGSRC_API_URL=https://imgsrc.test IMGSRC_API_KEY=imgsrc_xxxxxxxxxxxx IMGSRC_SOURCE=my-app
Optionally publish the config:
php artisan vendor:publish --tag=imgsrc-config
Building URLs
use ImgSrc\Laravel\Facades\ImgSrc; ImgSrc::url('photos/hero.jpg', ['w' => 1200, 'h' => 630, 'fit' => 'crop']); // => https://my-app.imgsrc.test/photos/hero.jpg?auto=format&fit=crop&h=630&w=1200 // Responsive srcset (width descriptors) ImgSrc::srcset('photos/hero.jpg', ['fit' => 'crop', 'ar' => '16:9']);
When IMGSRC_TOKEN is set, every URL is signed automatically (s= parameter) and
unsigned URLs are rejected by the server.
The Blade component
<x-imgsrc-img path="photos/hero.jpg" :width="1200" :height="630" alt="Hero" class="rounded-xl" />
Renders an <img> with src, a width-based srcset, sizes, lazy loading, and
async decoding. Pass :responsive="false" to skip the srcset, or extra rendering
parameters with :params="['blur' => 40, 'sat' => -100]".
Uploads & asset management
// Upload (from a path or an UploadedFile) ImgSrc::upload($request->file('avatar'), path: 'avatars/'.$user->id.'.jpg', overwrite: true); // List / search ImgSrc::assets(folder: 'avatars'); ImgSrc::asset('avatars/1.jpg'); // Delete ImgSrc::delete('avatars/1.jpg'); // Index files already in your bucket ImgSrc::sync('legacy-folder'); // Purge cached renders after replacing a file ImgSrc::purge('avatars/1.jpg'); // one asset ImgSrc::purge(); // entire source
Rendering parameters
All ImgSrc rendering parameters use the familiar imgix names: w, h, ar,
fit (clip|crop|fill|fillmax|max|min|scale), crop (incl. focalpoint,
entropy), dpr, rect, fm (jpg|png|gif|webp|avif), q,
auto=format,compress, bri, con, sat, hue, exp, gam, vib,
sharp, usm, blur, px, mono, sepia, invert, rot, flip, bg,
pad, border, corner-radius, trim, mark*, txt*, preset, and dl.