Download the PHP package tsrgtm/media-library without Composer

On this page you can find all versions of the php package tsrgtm/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 media-library

tsrgtm/media-library

Latest Version on Packagist Total Downloads PHP Version Laravel Version Filament Version

A high-performance, enterprise-grade Laravel media library and Google Drive-style Filament 5 workspace. Built by Tusar Gautam, featuring TUS resumable uploads with multi-file concurrency, zero-migration polymorphic model attachments, dynamic WebP responsive conversions, folder hierarchies, tag management, trash bin soft-deletes, static placeholder caching, and rich previews for documents, video, audio, code, and spreadsheets.


Table of Contents


Key Features


Zero Schema Hassle

[!IMPORTANT] No database changes required for your models!
You do NOT need to create any columns (such as featured_image_id, media_id, or gallery_ids) or write any database migrations for your posts, products, users, or categories tables.

tsrgtm/media-library manages all attachments through a central, highly-optimized polymorphic mediables table.


Requirements


Installation & Setup

1. Require via Composer

2. Run Package Installer

Run the automated installer command:

This command automatically:

3. Run Migrations

4. Build Frontend Assets


Package Management Commands

1. Installing the Package (media-library:install)

Options:

2. Updating Assets & Migrations (media-library:update)

When upgrading tsrgtm/media-library to a new release, run the update command to sync updated JS/CSS assets, replace modified files, and run pending database migrations:

Options:

3. Uninstalling & Reverting Changes (media-library:uninstall)

To completely revert all changes made by the package cleanly without leaving orphaned code or throwing errors:

This command automatically:

Options:

After running uninstall, complete package removal via Composer:


Tailwind CSS & Styling Setup

Self-Sufficient CSS (Zero Configuration)

The package ships with self-sufficient CSS in resources/css/media-library.css containing standalone Tailwind CSS directives. Component styles render cleanly out of the box without requiring manual CSS edits.

Custom Filament Theme Configuration

If you are compiling a custom Filament Tailwind CSS theme (e.g. resources/css/filament/admin/theme.css), add the package @source directives so Vite scans package views during build:


Filament Panel & Plugin Customization

Register the MediaLibraryPlugin inside your Filament Panel Provider (e.g., app/Providers/Filament/AdminPanelProvider.php).

You can customize navigation group, icon, label, sort position, and URL slug directly on the plugin builder:


Model Configuration (HasMedia Trait)

1. Adding Trait to Models

Simply include the HasMedia trait in any Eloquent model. No database columns or migrations are needed!

2. Attaching, Syncing, and Detaching Media

Use the trait methods to link Media records to model instances seamlessly:

3. Retrieving Media & Collections

4. Replacing Media

To swap an existing collection's media with a new file:


Filament Media Picker Form Component

The package includes an interactive MediaPicker form field for Filament resources and forms.

[!NOTE] MediaPicker automatically hydrates its state from your model's media collection and automatically saves relationship attachments on form submission. You do not need a matching column on your database table.

1. Single File Picker

2. Multi-File Picker with Reordering

3. Filtering by Kinds, Extensions, and MIME Types

Limit what files users can select or upload in the modal:

4. Default Folder & Custom Pivot Properties

5. Component Options Reference

Method Type Description Default
collection(string \| Closure) static Sets the pivot collection identifier. 'default'
multiple(bool \| Closure) static Allows selecting multiple media files. false
minItems(int \| Closure) static Minimum required items when multiple. null
maxItems(int \| Closure) static Maximum allowed items when multiple. null
acceptedKinds(array \| string) static Restrict selection by kinds (image, video, audio, document, archive). []
images() static Convenient shortcut for acceptedKinds(['image']). -
videos() static Convenient shortcut for acceptedKinds(['video']). -
audio() static Convenient shortcut for acceptedKinds(['audio']). -
documents() static Convenient shortcut for acceptedKinds(['document']). -
archives() static Convenient shortcut for acceptedKinds(['archive']). -
acceptedExtensions(array) static Restrict by extension list (e.g. ['png', 'jpg', 'pdf']). []
acceptedMimeTypes(array) static Restrict by MIME types (e.g. ['image/png']). []
defaultFolder(string) static Pre-opens picker modal to a folder slug. null
reorderable(bool) static Enables drag-and-drop reordering. true
removable(bool) static Allows removing selected media. true
replaceable(bool) static Allows swapping selected item. true
showFolders(bool) static Shows folder browser in picker modal. true

Placeholder Caching & Performance

When serving APIs or rendering lists with hundreds of media records, looking up extension/kind fallback placeholders continuously can introduce unnecessary CPU overhead.

tsrgtm/media-library features in-memory static placeholder caching:


Resumable TUS Uploads & Queue Processing

Large files (videos, high-res images, archives) are uploaded via chunked TUS HTTP protocols:

Run worker process in production:


API Controllers & Routes

The package registers administrative and file endpoints under config('media-library.route_prefix') (default /media):

Route Name Description
GET /media/files/{media} media.files.show Streams media file contents (soft-delete safe).
GET /media/files/{media}/variant/{variant} media.files.variant Streams WebP responsive image variant.
GET /media/picker/browse media.picker.browse JSON endpoint for Filament MediaPicker modal.
POST /media/picker/resolve media.picker.resolve Resolves media details by array of IDs.
POST /media/tus media.tus.create Creates TUS resumable upload session.
PATCH /media/tus/{session} media.tus.append Appends uploaded chunk data to file session.
HEAD /media/tus/{session} media.tus.offset Queries current upload byte offset.
DELETE /media/tus/{session} media.tus.delete Cancels and purges upload session.

Configuration Reference

Package settings located in config/media-library.php:


Testing

Run the Pest test suite:

Or execute directly via Pest:


License

The MIT License (MIT). Please see LICENSE.md for more details.


All versions of media-library with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/contracts Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/filesystem Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
filament/filament Version ^5.0
livewire/livewire Version ^4.0
intervention/image Version ^4.2
spatie/laravel-package-tools Version ^1.18
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 tsrgtm/media-library contains the following files

Loading the files please wait ...