This is the documentation for
v9 but the latest version is
v10
.
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
When getUrl
is called, the task of generating that url is passed to an implementation of Spatie\MediaLibrary\Support\UrlGenerator\UrlGenerator
.
The package contains a DefaultUrlGenerator
that can generate urls for a media library that is stored inside the public path. It can also generate URLs for S3.
If you are storing your media files in a private directory or are using a different filesystem, you can write your own UrlGenerator
. Your generator must implement the Spatie\MediaLibrary\Support\UrlGenerator\UrlGenerator
interface.