Download the PHP package filament/spatie-laravel-media-library-plugin without Composer

On this page you can find all versions of the php package filament/spatie-laravel-media-library-plugin. 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 spatie-laravel-media-library-plugin

Filament Spatie Media Library Plugin

Installation

Install the plugin with Composer:

If you haven't already done so, you need to publish the migration to create the media table:

Run the migrations:

You must also prepare your Eloquent model for attaching media.

For more information, check out Spatie's documentation.

Form component

You may use the field in the same way as the original file upload field:

The media library file upload supports all the customization options of the original file upload component.

The field will automatically load and save its uploads to your model. To set this functionality up, you must also follow the instructions set out in the setting a form model section. If you're using a panel, you can skip this step.

Passing a collection

Optionally, you may pass a collection() allows you to group files into categories:

Configuring the storage disk and directory

By default, files will be uploaded publicly to your storage disk defined in the Filament configuration file. You can also set the FILAMENT_FILESYSTEM_DISK environment variable to change this. This is to ensure consistency between all Filament packages. Spatie's disk configuration will not be used, unless you define a disk for a registered collection.

Alternatively, you can manually set the disk with the disk() method:

The base file upload component also has configuration options for setting the directory() and visibility() of uploaded files. These are not used by the media library file upload component. Spatie's package has its own system for determining the directory of a newly-uploaded file, and it does not support uploading private files out of the box. One way to store files privately is to configure this in your S3 bucket settings, in which case you should also use visibility('private') to ensure that Filament generates temporary URLs for your files.

Reordering files

In addition to the behaviour of the normal file upload, Spatie's Media Library also allows users to reorder files.

To enable this behaviour, use the reorderable() method:

You may now drag and drop files into order.

Adding custom properties

You may pass in custom properties when uploading files using the customProperties() method:

Adding custom headers

You may pass in custom headers when uploading files using the customHeaders() method:

Generating responsive images

You may generate responsive images when the files are uploaded using the responsiveImages() method:

Using conversions

You may also specify a conversion() to load the file from showing it in the form, if present:

Storing conversions on a separate disk

You can store your conversions and responsive images on a disk other than the one where you save the original file. Pass the name of the disk where you want conversion to be saved to the conversionsDisk() method:

Storing media-specific manipulations

You may pass in manipulations that are run when files are uploaded using the manipulations() method:

Filtering media

It's possible to target a file upload component to only handle a certain subset of media in a collection. To do that, you can filter the media collection using the filterMediaUsing() method. This method accepts a function that receives the $media collection and manipulates it. You can use any collection method to filter it.

For example, you could scope the field to only handle media that has certain custom properties:

Table column

To use the media library image column:

The media library image column supports all the customization options of the original image column.

Passing a collection

Optionally, you may pass a collection():

The collection allows you to group files into categories.

By default, only media without a collection (using the default collection) will be shown. If you want to show media from all collections, you can use the allCollections() method:

Using conversions

You may also specify a conversion() to load the file from showing it in the table, if present:

Infolist entry

To use the media library image entry:

The media library image entry supports all the customization options of the original image entry.

Passing a collection

Optionally, you may pass a collection():

The collection allows you to group files into categories.

By default, only media without a collection (using the default collection) will be shown. If you want to show media from all collections, you can use the allCollections() method:

Using conversions

You may also specify a conversion() to load the file from showing it in the infolist, if present:


All versions of spatie-laravel-media-library-plugin with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.45|^11.0
spatie/laravel-medialibrary Version ^10.0|^11.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 filament/spatie-laravel-media-library-plugin contains the following files

Loading the files please wait ....