Getting started
Library
Components
Integrations
Storage/disk driver
The FilesystemStorageDriver allows you to let the Media Library run on top of any Laravel filesystem disk. This works both for disks that already have data, as well as entirely empty disks. The Media Library works interchangeably with any other disk operations, thus zero configuration is needed.
Installation
Configure driver
To use the FilesystemStorageDriver, make sure you have configured the Laravel Filesystem storage disk that you want to use.
Next, register the driver as follows:
use RalphJSmit\Filament\MediaLibrary\Drivers\FilesystemStorageDriver;
$plugin
->driver(FilesystemStorageDriver::class)
Review disk
By default, the FilesystemStorageDriver uses the public disk. It is recommended to verify the disk before storing any media:
$plugin
->driver(FilesystemStorageDriver::class, function (FilesystemStorageDriver $driver) {
return $driver->disk('s3');
})
Review directory
In addition to the disk, you can also specify a directory within the disk:
$plugin
->driver(FilesystemStorageDriver::class, function (FilesystemStorageDriver $driver) {
return $driver->disk('s3')->directory('media');
})
You can override the maximum upload file size for this driver using the ->maxFileSizeKb() method:
$driver->maxFileSizeKb(25 * 1024) // 25 MB
By default, the limit is derived from Livewire's temporary upload rules. If no Livewire rule is configured, it falls back to 12 MB.
That's it! You now have a fully functional Media Library running on your filesystem storage disk as a driver.