Download the PHP package jcfrane/laravel-lens without Composer
On this page you can find all versions of the php package jcfrane/laravel-lens. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-lens
Laravel Lens
Configuration-driven image manipulation and caching for Laravel, inspired by Symfony's LiipImagineBundle.
Define named filter sets in your config, and Laravel Lens handles the rest — lazy processing on first request, automatic caching, and simple Blade integration. Built on top of Intervention Image and Laravel's filesystem abstraction, it works with any storage driver out of the box.
Quick Examples
Define filter sets in your config:
Use them anywhere in your application:
Features
- Configuration-driven filter sets — define once, use everywhere
- 14 built-in filters — thumbnail, crop, resize, scale, watermark, grayscale, flip, rotate, blur, brightness, contrast, background, strip, auto_orient
- Lazy processing — images are processed on first request, then served from cache
- Multiple storage drivers — works with local disk, S3, or any Laravel filesystem driver
- Blade integration —
@lens()directive and<x-lens-image />component - Built-in API route —
/lens/{filterSet}/{path}for on-demand processing - Cache management — Artisan commands for clearing and warming up the cache
- Multiple drivers — GD and Imagick support via Intervention Image
- Runtime overrides — pass options at call time without creating new filter sets
- Extensible — register custom filters with a simple interface
Requirements
- PHP 8.2+ (PHP 8.3+ for Laravel 13)
- Laravel 12 or 13
- GD or Imagick PHP extension
Installation
Publish the configuration file:
Configuration
The published config file (config/lens.php) contains all settings:
Driver
Data Loader
Configure where source images are loaded from. Uses Laravel filesystem disks:
Cache
Configure where processed images are stored:
Stampede Protection
When a popular image is requested before its variant is cached, many concurrent requests can each decode the full-size source into memory. Enable the lock so only one request runs the pipeline while the rest wait for the cached result:
Requires a cache store that supports atomic locks (redis, memcached, database, file, array, dynamodb).
Filter Sets
Each filter set defines an ordered pipeline of filters:
Routes
Usage
Blade Directive
Blade Component
The component renders an <img> tag with the filtered image URL and passes through any additional HTML attributes.
Facade
Runtime Filter Overrides
Override filter options at call time without creating a new filter set:
API Route
The package auto-registers a route for on-demand image processing:
On the first request, the image is processed through the filter pipeline and cached. Subsequent requests are served from cache with a redirect.
Example: /lens/thumbnail_small/photos/landscape.jpg
Available Filters
| Filter | Options | Description |
|---|---|---|
auto_orient |
— | Rotate based on EXIF orientation data |
thumbnail |
size, mode, upscale |
Scale and/or crop to thumbnail dimensions |
crop |
size, start |
Crop a rectangular region |
resize |
size |
Resize to exact dimensions |
scale |
size |
Scale proportionally |
watermark |
image, position, opacity, size |
Overlay a watermark image |
grayscale |
— | Convert to grayscale |
flip |
direction |
Mirror horizontally or vertically |
rotate |
angle, background |
Rotate by degrees |
blur |
amount |
Apply Gaussian blur |
brightness |
level |
Adjust brightness (-100 to 100) |
contrast |
level |
Adjust contrast (-100 to 100) |
background |
color, size, position |
Set or extend canvas with background color |
strip |
— | Remove animation frames |
Custom Filters
Create a class implementing FilterInterface:
Register it in a service provider:
Then use it in your filter sets:
Artisan Commands
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please use the issue tracker.
Credits
- JC Frane
- All Contributors
Acknowledgments
- LiipImagineBundle — the Symfony bundle that inspired this package
- Intervention Image — the underlying image processing library
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-lens with dependencies
intervention/image Version ^3.0
illuminate/support Version ^12.0|^13.0
illuminate/filesystem Version ^12.0|^13.0
illuminate/routing Version ^12.0|^13.0
illuminate/cache Version ^12.0|^13.0
illuminate/console Version ^12.0|^13.0
illuminate/view Version ^12.0|^13.0