Download the PHP package x-laravel/spatie-media-library-uuid-path without Composer

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

spatie-media-library-uuid-path

Tests PHP Laravel

A UUID-based path generator for spatie/laravel-medialibrary.

The Problem

spatie/laravel-medialibrary's default DefaultPathGenerator stores media files in a flat structure based on the primary key (ID):

This works fine for small applications, but causes serious issues as the number of media files grows:

The Solution

This package distributes files evenly by turning the first 8 characters of each media UUID into a four-level directory hierarchy:

Conversions and responsive images are placed in dedicated subdirectories under the UUID folder:

Benefits:

Requirements

Installation

Setup

Publish the spatie/laravel-medialibrary config (if you haven't already) and set the path_generator option:

In config/media-library.php:

Why UuidFileRemover? The default file remover deletes the UUID directory but leaves the empty shard parent directories (55/0e/84/00/) behind. UuidFileRemover cascades upward and removes each shard level when it becomes empty.

Migrating from DefaultPathGenerator

If your project already has media files stored with spatie's default ID-based structure (1/photo.jpg, 2/photo.jpg), you can migrate them to the UUID path structure without any downtime:

1. While your config still points to DefaultPathGenerator, run:

2. Once it completes, switch the config to this package:

The command moves all files (including conversions and responsive images), deletes the old ID directories, and is safe to re-run — it skips media whose old directory no longer exists.

Options:

Option Description
disk Disk to migrate (defaults to media-library.disk_name config)
--dry-run Preview what would be moved without touching any files
--force Skip the production confirmation prompt

Cleaning Orphaned Directories

spatie's built-in media-library:clean command identifies orphaned directories using an is_numeric() check, which only works for the default ID-based path structure. This package ships a UUID-aware replacement:

Options:

Option Description
disk Disk to clean (defaults to media-library.disk_name config)
--dry-run List orphaned directories without deleting them
--force Skip the production confirmation prompt

Running Tests


All versions of spatie-media-library-uuid-path with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/laravel-medialibrary Version ^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 x-laravel/spatie-media-library-uuid-path contains the following files

Loading the files please wait ...