emaia / laravel-mediaman
MediaMan - Elegant & powerful media management package for Laravel!
Requires
- php: ^8.3
- ext-curl: *
- ext-fileinfo: *
- illuminate/database: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- illuminate/validation: ^12.0|^13.0
- intervention/image: ^4.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pao: ^1.0
- laravel/pint: ^1.29
- mockery/mockery: ^1.6
- orchestra/testbench: ^10.0|^11.0
- orchestra/workbench: ^10.0|^11.0
- pestphp/pest: ^v4.7.0
Suggests
- intervention/image-driver-vips: Higher-throughput image processing via libvips — set MEDIAMAN_DRIVER=vips (or rely on auto-detection) after installing the package and ext-vips.
This package is auto-updated.
Last update: 2026-06-26 00:23:18 UTC
README
Laravel MediaMan
MediaMan is an elegant and powerful media management package for Laravel apps with a painless uploader, virtual collections, automatic conversions and responsive images, and per-model channel associations.
The API is fluent and UI-agnostic — you stay in control of how things look and behave. Equally at home in a web app or an API server.
Quick example
$media = MediaUploader::fromRequest('featured_image') ->useCollection('Posts') ->upload(); $post = Post::find(1); $post->attachMedia($media, 'featured-image-channel');
Core concepts
- Media — any uploaded file, persisted as its own record. Validate types/sizes in your form requests.
- MediaUploader — fluent entry point. Uploads exist independently of any model.
- MediaCollection — a virtual group of media; many-to-many with Media. Great for asset libraries.
- Channel — a per-model tag (
avatar,gallery, …) stored in the polymorphicmediaman_mediablespivot. Channels also drive conversions. - Conversion — a transformation registered globally (resize, watermark, format change) and run when media is attached to a channel.
- Responsive Images — multi-size, multi-format variants (AVIF/HEIC/WebP/JPG/PNG) with ready-made
<picture>/srcsetHTML.
Documentation
| Installation | Requirements, composer, publishing assets, upgrade paths |
| Configuration | Disk, queue, image driver, validation, security, MediaResolver, per-variant disk, responsive images, placeholder |
| Media | The Media entity: retrieve, update, delete, HTTP responses, mail, copy/attachTo |
| Uploads | MediaUploader: source, fromRequest, fromDisk, fromBase64, fromUrl, fromStream, fromString |
| Models & associations | HasMedia trait, channels, channel-level validation rules, ordering, fallbacks |
| Collections | MediaCollection: CRUD, validation, auto-prune |
| Conversions | Global registration, per-channel execution, per-conversion disk, format detection, failure isolation |
| Responsive images | Generation, per-format quality, HEIC/AVIF/WebP support, <picture> / srcset, width calculators |
| Security | SVG sanitizer, disallowed extensions, file-size bounds, SSRF guard, orphan cleanup |
| Events | The six package events |
| Artisan commands | Doctor health check, publish assets, orphan cleanup, conversion/responsive generation and stats |
| Recipes | PDF/video thumbnails, image optimization, ZIP downloads, multi-file uploads, partial attach |
| API reference | Public surface by class/trait |
Release history: CHANGELOG.md. Upgrade notes: UPGRADING.md.
Requirements
| Laravel | Package | PHP |
|---|---|---|
| v12–v13 | 2.x–3.x | 8.3+ |
Quick install
composer require emaia/laravel-mediaman php artisan mediaman:publish php artisan storage:link php artisan migrate
See Installation for the full setup, including the upgrade path for existing installations.
Contribution and license
Found a bug? Open an issue. Feature requests & PRs are welcome.
The MIT License (MIT). Please read the License File for more information.