Associate uploaded files with Eloquent models, with thumbnails and responsive images
open coreMITfree
Laravel Media Library is Spatie's package for attaching files to Eloquent models in Laravel: add a file from a path or straight from an upload to a named media collection, store it on any filesystem Laravel supports (local disk, S3 and others), and get its URL back from the model. It generates derived images such as thumbnails for images, videos and PDFs, and responsive images. The package is free and open source; Media Library Pro, sold separately by Spatie, adds Blade, Vue, React and Livewire components for uploading and managing a collection.
Problems it solves
- let users upload photos to a record in my Laravel app and keep track of them
- generate thumbnails for images and PDFs uploaded in Laravel
- store some uploads on S3 and others locally in a Laravel app without writing the plumbing
Features
- attach files and uploads to Eloquent models in named collections
- store media on any Laravel filesystem, such as S3
- thumbnails for images, videos and PDFs, and responsive images
- paid Pro UI components for uploads (Blade, Vue, React, Livewire)
Ways to run it
Laravel Media Library
Only in this edition
- media collections on Eloquent models
- thumbnails and responsive images
- any Laravel filesystem
Not included
- upload and management UI components
Media Library Pro
one-time licence with a year of updates; on sale on 28 Nov 2026 at $94 for one application, $359 for unlimited applications3
Only in this edition
- React, Vue and Livewire v3 upload components
- temporary uploads
- Laravel Vapor support
- Tailwind CSS styles
