Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

Getting started with laravel-medialibrary: a video tutorial

laravel-medialibrary is probably one of our most powerful packages. It can associate files with Eloquent models. It can also generate derived images such as thumbnails. It has a very developer-friendly API to work with. Here’s a quick example:

$yourModel->getMedia('images')->first()->getUrl('thumb');

Want to store some large files on another filesystem? No problem:

$yourModel->addMedia($bigFile)->toMediaCollection('downloads', 's3');

Because the package can do so much, the docs have grown quite large. If you’re a visual learner, you’ll be happy to know that I’ve made a video that shows what the medialibrary is capable of.

Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band. He loves waffles and butterflies.