Download the PHP package crumbls/filament-media-library without Composer

On this page you can find all versions of the php package crumbls/filament-media-library. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-media-library

Filament Media Library

A WordPress-style media library for Filament 5. Provides a central media pool with polymorphic attachments, so any model in your application can reference shared media through a clean pivot table.

Built on top of Spatie Media Library for file handling and image conversions.

Requirements

Installation

The package auto-discovers its service provider. Migrations run automatically -- no publishing required.

Run the migrations:

Register the plugin in your Filament panel provider:

Configuration

Publish the config file to customize settings:

Usage

Media Library Page

Once the plugin is registered, a "Media Library" page appears in your Filament panel navigation. It provides:

Attaching Media to Models

Add the HasMediaLibrary trait to any Eloquent model:

This gives you a full API for managing media attachments:

MediaPicker Form Component

Use the MediaPicker in any Filament form to let users select media from the library:

Multiple selection:

Limit selections:

Named collection:

The picker opens a modal with search, pagination, and thumbnail previews. Selected media is stored as an ID (single) or array of IDs (multiple) on the model.

Database Column Requirements

The MediaPicker stores a media_library.id reference directly on your model's table. You must ensure:

  1. The column exists -- Add a nullable unsigned big integer column for the field name you pass to MediaPicker::make().
  2. The column is fillable -- Add the column name to your model's $fillable array.

Example migration for adding an avatar column to a users table:

Then in your model:

If you have an accessor on the same column (e.g., getAvatarAttribute()), remove it -- the MediaPicker needs the raw integer ID during form hydration. Use a separate method to resolve the media URL:

MediaColumn Table Column

Display media thumbnails in Filament tables:

Options:

Performance tip: Eager-load the media relation to avoid N+1 queries:

Media Model

The Media model wraps Spatie Media Library and provides convenient accessors:

Metadata fields:

Field Type Max Length
title string 255
alt_text string 255
caption text 1000
description text 5000

The model uses soft deletes. Each record gets an auto-generated UUID and tracks uploaded_by (foreign key to users).

Database Schema

The package creates two tables:

media_library -- Central media records

Column Type
id bigint (PK)
uuid string (unique)
title string (nullable)
alt_text string (nullable)
caption text (nullable)
description text (nullable)
disk string (default: 'public')
uploaded_by foreign key to users (nullable)
created_at timestamp
updated_at timestamp
deleted_at timestamp (soft delete)

mediables -- Polymorphic pivot table

Column Type
id bigint (PK)
media_id foreign key to media_library
mediable_type string
mediable_id bigint
collection string (default: 'default')
order unsigned int (default: 0)
created_at timestamp
updated_at timestamp

Spatie Media Library also creates its own media table for the underlying file records.

Publishing Assets

Storage Disk

Set the storage disk via environment variable or config:

Any disk defined in config/filesystems.php works -- public, s3, r2, or a custom disk.

Extending the Media Model

Swap in your own Media model by updating the config:

Your custom model should extend the package's Media model:

Security

Uploads are validated server-side:

Rejected uploads dispatch an fml-uploads-rejected Livewire event with details for frontend notification.

Development

Code Style

This project uses Laravel Pint for code formatting. A pre-push git hook runs Pint automatically and blocks pushes with style violations.

Run Pint manually:

Static Analysis

Larastan is configured at level 5:

Roadmap

Add throttling to uploads. Add lifecycle events. Add tenant scoping.

Testing

The package uses Pest with 197 tests:

License

MIT. See LICENSE.


All versions of filament-media-library with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/filament Version ^5.0
spatie/laravel-medialibrary Version ^11.0
laravel/framework Version ^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package crumbls/filament-media-library contains the following files

Loading the files please wait ...