Download the PHP package waad/filament-media without Composer
On this page you can find all versions of the php package waad/filament-media. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download waad/filament-media
More information about waad/filament-media
Files in waad/filament-media
Package filament-media
Short Description Filament integration for waad/media package for Media Upload Locally Or Cloud S3
License MIT
Homepage https://github.com/waadmawlood/filament-media
Informations about the package filament-media
Filament Media
This package integrates Filament v3/v4/v5 with the waad/media manager. It is an alternative to spatie/laravel-medialibrary for projects on waad/media. The MediaUpload form component aligns with your Eloquent model’s registerCollections() (single vs multiple, disks, labels).
Requirements
- PHP:
^8.1 - Filament:
^3.0|^4.0|^5.0 - Livewire:
^3.5|^4.0 - waad/media:
^4.1
Installation
You can install the package via composer:
Setup & Usage
Since this package works in tandem with waad/media, your Eloquent Models should use the HasMedia trait and implement registerCollections: waad/media Package.
MediaUpload::make('name') uses the field name as the waad/media collection by default. Call ->collection(...) only when the Filament field name should differ from the collection key (string), or when the collection must be resolved at runtime (Closure); pass null to rely on evaluation falling back to the field name.
Now, in your Filament resource or form:
The component loads existing media IDs for previews, syncs new uploads via syncMedia, removes files with deleteMedia, and persists reorder when only existing items change.
Reordering multiple files (index)
For collections with 'single' => false, you can enable drag-and-drop reordering with Filament’s reorderable() (same as FileUpload). Order is stored in waad/media’s index column on the media table.
- Loading the form: existing files are listed sorted by
index, then by id, so the UI matches the saved order. - Saving the form: when only existing media are present (no new uploads in that save), the component writes the current list order back to the database as
indexvalues (1,2,3, …) for that collection.
Use this together with a multi-file collection in registerCollections(). Single-file collections ignore ordering.
Preview images in tables
In list/table views, use Filament’s ImageColumn and resolve URLs from your model with waad/media’s getCollectionUrls() (provided by HasMedia). Pass the same collection name you use in registerCollections() and in MediaUpload::make(...).
- For a single-file collection (
'single' => true),getCollectionUrlstypically returns one URL string (or an empty value when there is no file). - For a multi-file collection, it returns an array of URLs;
ImageColumncan show them as a stacked preview when the state is an array.
Adjust the column name (banner here) to match your collection key.
Pruning old media
waad/media registers the media:prune Artisan command. It removes media files and database rows according to the retention setting prune_media_after_day in your published config/media.php (see the waad/media docs for details).
Run it manually or on a schedule (for example Laravel’s scheduler in routes/console.php):
Testing
This package uses Pest for testing. To run tests:
License
This package is open-sourced software licensed under the MIT license.
All versions of filament-media with dependencies
filament/filament Version ^3.0|^4.0|^5.0
livewire/livewire Version ^3.5|^4.0
waad/media Version ^4.1