MS

Filament Media Manager

Filament Media Manager

Overview

An open-source media library for Filament admin panels: folders, tags, pickers and rich-editor embeds on top of Spatie Media Library.

Filament Media Manager is an open-source Composer package that adds a folder-based media library to Filament admin panels, built on top of Spatie Media Library. It gives editors a browser, folders, tags and pickers, and gives developers a component they can drop into a form, a table or a rich editor. I designed and maintain the package, from the data model and the browser to the tests, translations and releases.

The media browser: folders, file grid and details panel

The problem

Most admin panels start with a single upload field. It works for one logo and becomes a mess at the second campaign: every image lands in the same list, names collide, nobody knows which file belongs to which page, and replacing a photo means uploading a new one and hunting down the old references. Filament has excellent form components but no real asset manager, and the storage package underneath is good at files, not at folders, tags or reuse. Developers end up writing the same library again for every project, usually without tenancy, validation or a way to browse more than a few hundred files. A shared package has to solve the boring parts properly: pagination that does not fall over on a large folder, pickers that behave like native fields, and isolation when several tenants share one installation.

The solution

A media library where folders are first-class rows, files carry metadata, and any Eloquent model can attach a file in a named collection. A Livewire browser handles search, filters, sorting and selection, with paging and sorting done in the database so a folder with tens of thousands of files still opens quickly. Form pickers support single and multiple selection, relationship mode and directory scoping, and apply the same validation rules as a native upload field. Tenancy is opt-in and fail-closed: with it on, no resolvable tenant means no reads and no writes.

Goals

  • A real library, not a longer upload field: folders, tags, metadata and reuse, so an image can serve several records without being copied.

  • Native behaviour in the panel: a picker that validates like a Filament field and a browser that stays fast as the library grows.

  • Safe for multi-tenant apps: one switch, indexed columns and a fail-closed default, with no cross-tenant folder nesting.

What I built

The library model

  • Folders as a tree: a folder has a parent, children and recursive statistics, so a library can follow the structure of a site instead of becoming one long list.

  • Files with useful metadata: name, caption, alt text, size, extension, mime type, dimensions and uploader, so accessibility and display decisions do not depend on the filename.

  • Tags across files: tags are polymorphic and unique per tenant, which lets an editor group images by campaign or theme without moving them out of their folder.

  • Attachments to any record: a file can be attached to a product, a page or an order in a named collection and in a chosen order, with the bytes stored once.

Browsing

Filtering by type, tag and size with multiple selection
  • Search and filters: search by name, filter by tag, type and size, and sort by the field the editor chooses, all applied in the query rather than in memory.

  • Paging that holds: a selected file's page is computed from the sorted ids, so selecting an item does not jump the grid back to page one.

  • Modal and page modes: the same browser opens as a modal from a form or as a full page for library work, which matters when an editor is organising rather than picking.

  • Selection and details: multiple selection, a details panel and a delete path that respects the host application's policy instead of deleting blindly.

Picking and editing

The media picker inside a form
  • A picker that behaves natively: single or multiple, relationship mode for pivot attachments, and collection or directory scoping, with the picked ids validated against the scoped query.

  • Validation parity: required, minimum, maximum and custom rules apply to the picked files, not only to a new upload, which is the part most pickers get wrong.

  • Upload and crop: uploads pass through one service that validates and stores them, and the upload component supports a manual crop before the file is saved.

  • Rich editor embeds: images and files inserted into rich text become proper nodes with an attachment provider, so a URL is generated centrally instead of being pasted into the content.

Tables, entries and tenancy

  • Columns and entries: a media column for tables, and image and file entries for read-only views, with signatures that work on both supported Filament versions.

  • Tenant scoping: a resolver and a column give each tenant its own files, folders and tags, with indexed queries and a folder parent check that refuses cross-tenant nesting.

  • Fail-closed: with tenancy enabled and no resolvable tenant, reads return nothing and writes throw, which is the only safe default for a shared asset library.

  • Configurable by the host: the page, file, folder, tag and attachment models, the disk and the navigation group are plugin options, so an app can customise behaviour without forking.

Packaging and trust

  • Two Filament versions, one branch: Filament 4 and 5 are supported together, with compatibility shims where a signature changed, so host apps are not forced to upgrade at once.

  • Twenty translations: the interface ships in twenty languages, so a host app does not maintain a translation file for every locale it serves.

  • A public security process: a disclosed vulnerability was fixed in a patched release with an advisory naming the affected versions, and picker configuration can no longer be changed from the browser.

  • Tests without a host app: the package boots under Orchestra Testbench, so the browser, pickers, uploads, tenancy and security paths are tested in isolation.

Architecture

A Laravel package for Filament 4 and 5, with Livewire for the browser and the pickers, Spatie Media Library 11 for storage and conversions, and Pest with Orchestra Testbench so components are tested without a host application. Spatie keeps the binaries, while the package adds folders, file metadata, tags and attachments, which is what lets one file be reused across records and collections without duplicating bytes. The browser pages and sorts in SQL, caches the schema with explicit invalidation, and treats public Livewire properties as hostile after the advisory. The service provider publishes config, migrations, views and translations, and the plugin exposes the page, models, disk and navigation as options. Built in 2026 and still in active development.

Result

Over 40,000 installs on Packagist, about 12,000 a month, and used in production applications, including several of my own, as the media library behind their admin panels. Developers get a browser and a picker without writing one, editors get folders and tags instead of a flat list, and host apps get tenant isolation and policy-aware deletes without forking the storage layer.

Interactive preview

Scroll inside the browser window — every page is a real screenshot of the app.

Portfolio

Related work

DHD RH
DHD Warehouse

Contact

Get in touch

Have a project in mind?
Just say hello.

Address

Sidi Bel Abbess, Algeria