Download the PHP package waad/media without Composer

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

Total Downloads Latest Stable Version License

Media Files Package

A Laravel package for managing media files across multiple storage drivers (local, S3, and any Laravel filesystem disk) with Eloquent model relationships. An alternative to spatie/laravel-medialibrary.

Authors

Requirements

Installation

  1. Install via Composer:

  2. Publish the configuration and migration files:

  3. Edit the config file at config/media.php
  4. Run the migrations:

  5. (Optional) Create storage symbolic links:

Usage

Setup the Trait

Add the HasMedia trait to any Eloquent model:

Uploading Media

The upload service works with any Laravel filesystem disk — local, S3, or any custom driver. Just set the disk() and it handles the rest.

Media Collections

Register custom collections in your model to define specific media groups with their own storage configuration:

When uploading to a registered collection, its disk, bucket, and label are applied automatically:

Retrieving Media

Ordering Media by Index

Use orderByIndexMedia() to order media results by the index column. This is enabled by default, so media is automatically sorted by index unless explicitly disabled. default value for orderByIndexMedia() method is true so you can remove it when you want to order by index.

The orderByIndexMedia() method is fluent and can be chained with any media retrieval method that returns a collection or query result.

Syncing Media

Use syncMedia() when you want to remove existing rows in a collection and optionally upload replacements. Deletes run before the new upload, and only affect the active collection (the default collection, or the one set with collection() on the chain, or the $collection argument passed to upload()). Media in other collections on the same model is left alone.

Remove specific records, then upload

Pass database IDs of Media rows to soft-delete before new files are stored. IDs that do not belong to the active collection are ignored (no rows removed).

Replace everything in the collection

If you omit the second argument (or pass an empty array), existing media in that collection is removed first, then new files are uploaded. This is useful for a full “replace gallery” flow.

Additive uploads (no removal)

To upload new files without running the sync removal step, use syncMediaWithoutDettached() or chain setIsWithDettachedSync(false) after syncMedia():

You can still combine with collection(), disk(), and the rest of the fluent API as with addMedia().

Deleting Media

Approving Media

File Utilities

The upload service provides disk-aware utility methods that work with any storage driver:

Filament

To use waad/media inside Filament admin panels, install the companion package waad/filament-media. It provides a MediaUpload form component that lines up with HasMedia and registerCollections() (single vs multiple files, disks, reordering via index, and sync behavior).

See the Filament plugin documentation for setup, MediaUpload::make(...), and table previews with getCollectionUrls().

Configuration

Customize the package in config/media.php:

Media Model Attributes

Attribute Type Description
basename string Hashed file name on disk
filename string Original uploaded file name
path string Full path in storage
index int Order index (default 1)
label string Custom label
collection string Collection name
disk string Storage disk (hidden)
bucket string Storage bucket/folder (hidden)
mimetype string File MIME type
filesize int File size in bytes
approved bool Approval status
metadata json Additional metadata (e.g. image dimensions)
full_url string Appended: public URL to the file

Artisan Commands

Command Description
php artisan media:link Create symbolic links from disk roots to public paths based on the shortcut config. Use --force to recreate existing links.
php artisan media:prune Permanently delete soft-deleted media records (and their files) older than prune_media_after_day.

Features

Testing

License

MIT © Waad Mawlood


All versions of media with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
league/flysystem-aws-s3-v3 Version ^3.0
laravel/framework Version ^9.0|^10.0|^11.0|^12.0|^13.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 waad/media contains the following files

Loading the files please wait ...