immera / filament-media-library
A folder-based media library and picker field for Filament v4/v5, built on Spatie Media Library.
No longer found in upstream repository
Requires
- php: ^8.2
- filament/filament: ^4.0|^5.0
- filament/spatie-laravel-tags-plugin: ^4.0|^5.0
- livewire/livewire: ^3.4|^4.0
- spatie/laravel-medialibrary: ^11.5
- spatie/laravel-tags: ^4.0
- spatie/pdf-to-image: ^3.3
README
A folder-based media library and picker field for Filament v4 and v5, built on top of Spatie Media Library.
Features
- A full-page media manager (folders, search, sort, upload, tagging, PDF page-count preview) registered as a Filament page.
- A
MediaPickerform field (extendsModalTableSelect) for selecting media from within any Filament form/resource. - Folder tree organization on top of Spatie Media Library's
mediatable. - Automatic PDF thumbnail placeholder generation.
Installation
composer require immera/filament-media-library
This package builds on Spatie Media Library and Spatie Tags, neither of which run their migrations automatically. If your app doesn't already have media and tags/taggables tables, publish and run them:
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations" php artisan vendor:publish --provider="Spatie\Tags\TagsServiceProvider" --tag="tags-migrations" php artisan migrate
Register the plugin on your panel:
use Immera\FilamentMediaLibrary\FilamentMediaLibraryPlugin; public function panel(Panel $panel): Panel { return $panel // ... ->plugins([ FilamentMediaLibraryPlugin::make(), ]); }
Publish Filament's assets so this package's compiled CSS is copied into your public/ directory:
php artisan filament:assets
No Vite/Node setup is required for this — the package ships a precompiled, self-contained stylesheet and registers it with Filament directly. Re-run this command whenever you update the package. If your app's composer.json has a post-autoload-dump script calling @php artisan filament:upgrade (added by filament:install), this happens automatically on every composer update.
Optionally publish the default PDF thumbnail placeholder image to customize it:
php artisan vendor:publish --tag=filament-media-library-assets
Usage
use Immera\FilamentMediaLibrary\Forms\Components\MediaPicker; MediaPicker::make('featured_image') ->showFileName() ->downloadable() ->acceptedFileTypes(['image/*']);
License
MIT