Download the PHP package haosheng0211/filament-media-browser without Composer
On this page you can find all versions of the php package haosheng0211/filament-media-browser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download haosheng0211/filament-media-browser
More information about haosheng0211/filament-media-browser
Files in haosheng0211/filament-media-browser
Package filament-media-browser
Short Description A standalone Filament v3 media browser powered by Laravel Storage — no database required.
License MIT
Homepage https://github.com/haosheng0211/filament-media-browser
Informations about the package filament-media-browser
Filament Media Browser
A standalone Filament v3 media browser powered by Laravel Storage — no database required. Browse, upload, and manage files directly from the filesystem with folder navigation support.
Features
- Browse files and folders on any Laravel Storage disk
- Upload, delete files and create/delete folders
- Breadcrumb navigation with subfolder support
- Filter by media type (image, video/audio, or all files)
- Search files by name
- Filename sanitization and collision handling
- Path traversal protection
- Authentication guard on all operations
- Dark mode support
- Works with any Filament v3 panel or Livewire component
Installation
Publish the config file:
Add the package views to your tailwind.config.js content array:
Then rebuild your assets:
Make sure the storage disk is linked (for the public disk):
Configuration
Security note: Any user passing the configured guard can open the browser against any whitelisted disk. Keep
allowed_disksnarrow, setguardto your panel's guard, and useauthorization(a Gate ability) to restrict who can read/write/delete media.
Usage
MediaPicker Field
A dedicated form field with square card previews, replace and remove buttons. Both single and multiple modes use the same grid layout with 1:1 aspect ratio cards. Stores the selected file's URL as a string (single) or array of strings (multiple) by default.
Stored value:
- Single mode: string (e.g.
/storage/media/photo.jpg) — use astringcolumn - Multiple mode: array of strings — use a
jsoncolumn with->cast('array')on the model - Default output is
Storage::url()(full URL). Use->storePath()to store the relative path (e.g.media/photo.jpg) instead.
Available Methods
| Method | Description |
|---|---|
->multiple(bool) |
Enable multi-select mode |
->maxItems(int) |
Maximum number of files (multiple mode) |
->reorderable(bool) |
Enable drag-to-reorder (multiple mode, default: true) |
->mediaType(string) |
'image' (default), 'media', or 'file' |
->mediaDisk(string) |
Override config disk |
->mediaDirectory(string) |
Override config directory |
->storeAsUrl(bool) |
Store as Storage::url() output (default: true) |
->storePath(bool) |
Store as relative path (e.g. media/photo.jpg) |
->gridColumns(int) |
Number of columns in the preview grid (default: 5) |
With Filament Forms TinyMCE
This package works seamlessly with filament-forms-tinymce. Once both packages are installed, TinyMCE's file picker will automatically use the media browser.
Standalone Usage via Events
The media browser communicates via Livewire events, so you can integrate it with any component.
Open the browser by dispatching the open-media-browser event:
Listen for file selection via the media-selected event:
Event Reference
| Event | Direction | Parameters |
|---|---|---|
open-media-browser |
You → Browser | statePath, mediaType (image | media | file), multiple?, disk?, directory?, storeAsUrl? |
media-selected |
Browser → You | statePath, url, alt, title, filename, extension, size, mime |
Media Types
| Value | Filters |
|---|---|
image |
image/* only |
media |
video/* and audio/* |
file |
All files (no filter) |
Customizing Views
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-media-browser with dependencies
filament/filament Version ^3.0
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0
livewire/livewire Version ^3.0