This is the documentation for
v9 but the latest version is
You can switch versions in the menu on the left/at the top.
Check your current version with the following command:
composer show spatie/laravel-medialibrary
This package can associate all sorts of files with Eloquent models. It provides a simple, fluent API to work with. The Pro version of the package offers Blade, Vue and React components to handle uploads to the media library and to administer the content of a medialibrary collection.
Here are some quick code examples:
$yourModel = YourModel::find(1);
It can also directly handle your uploads:
Want to store some large files on another filesystem? No problem:
The storage of the files is handled by Laravel's Filesystem, so you can plug in any compatible filesystem.
The package can also generate derived images such as thumbnails for images, videos and PDFs. Once you've set up your model, they're easily accessible:
##Are you a visual learner?
We've recorded a video course on how to use this package. It's the best way to get started using media library
##We have badges!