Download the PHP package rayzenai/file-manager without Composer

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

Latest Version on Packagist Total Downloads

Laravel File Manager for Filament

A comprehensive Laravel package for Filament v4 that provides advanced file management with automatic image resizing, compression, media metadata tracking, and seamless S3 integration. Built for high-performance applications handling large volumes of media content.

This package is developed and maintained by Kiran Timsina and RayzenTech.

Key Features

Core Features

Advanced Processing

Developer Experience

About the Developers

Kiran Timsina is a full-stack developer specializing in Laravel and Filament applications. Connect on GitHub.

RayzenTech is a tech startup based in Nepal focused on creating smart business solutions. We specialize in automating complex processes and making them simple, from business automation to robotic process automation. Learn more at RayzenTech.


Requirements

Storage Configuration

This package works with both AWS S3 and Cloudflare R2. Choose one of the following configurations:

Option 1: Using AWS S3

1. Configure .env file:

2. Configure config/filesystems.php:

3. Configure config/livewire.php (if using Livewire uploads):

Option 2: Using Cloudflare R2

1. Configure .env file:

2. Configure config/filesystems.php:

3. Configure config/livewire.php (if using Livewire uploads):

Option 3: Using S3 Disk with R2 (Simplified)

If you prefer to use the standard S3 configuration with R2, you can configure R2 using the AWS environment variables:

Configure .env file:

This approach uses the existing s3 disk configuration in filesystems.php without creating a separate r2 disk.

Storage Driver Comparison

Feature AWS S3 Cloudflare R2
Storage Cost ~$0.023/GB $0.015/GB
Egress Fees $0.09/GB after 1GB $0 (free egress)
API Compatibility Native S3 API S3-compatible API
Region Config Specific region (e.g., us-east-1) Always use 'auto'
Best For AWS ecosystem integration Cost-effective, high bandwidth usage

Installation

  1. Install via Composer:

  2. Publish the configuration:

  3. Publish and run migrations (for media metadata):

  4. Configure storage and environment variables:

    See the Storage Configuration section above for detailed setup instructions for AWS S3 or Cloudflare R2.

    Additional configuration options for .env:

  5. Register the plugin in your Filament panel provider:

Configuration

The configuration file config/file-manager.php allows you to customize:

Usage in Models

Using the HasMultimedia Trait

The HasMultimedia trait automatically handles media file processing including image resizing, video compression, and document management:

Key Features:

Usage in Filament Resources

SEO Title Support

The package includes built-in SEO title functionality for better search engine optimization of media files:

Configuration:

Control which models receive SEO titles in config/file-manager.php:

MediaUpload Component

The MediaUpload component extends Filament's FileUpload with automatic compression and metadata tracking:

Available Methods:

Image Methods:

Video Methods:

Important Notes:

Features:

MediaModalColumn and MediaUrlColumn

Display images in tables with different interaction styles:

MediaModalColumn

Display images with modal preview and optional editing capabilities:

MediaUrlColumn

Display images that link to a dedicated media page:

Common Methods (both components):

MediaModalColumn specific methods:

MediaUrlColumn specific methods:

Features:

Relationship Support (v4.3+):

The relationship parameter allows you to display and manage images from related models:

This will:

Default Sizes

You can configure default sizes for MediaColumn components in your configuration:

Or via environment variables:

Available size configurations:

Individual columns can still override these defaults (limited to thumbnail size only):

S3Image Column

Display images in tables with modal preview:

Media Metadata Management

The package includes a powerful Filament resource for comprehensive media management.

Dashboard Features

Navigation & Monitoring

File Management

Advanced Filtering

Individual File Actions

  1. Open in Panel: Navigate directly to the parent resource
  2. Resize: Generate all configured size variations
  3. Compress: Apply custom compression settings
  4. Rename: Update file names in database
  5. Delete Resized: Remove all size variations

Bulk Operations

Bulk Compress

Bulk Resize

Bulk Delete Resized

Image Processor Page

The MediaMetadata resource includes a dedicated Image Processor page - a powerful tool for testing and optimizing your image processing pipeline.

Features:

Upload & Process

Processing Options

Compression Drivers

Results & Analytics

Use Cases:

  1. Test compression settings before applying to production
  2. Optimize images for specific use cases
  3. Compare processing drivers (GD vs Imagick)
  4. Evaluate different output formats (WebP, AVIF, JPEG, PNG)
  5. Generate samples for documentation

Service Methods

Using the FileManager Facade

Image Compression Service

Compression Drivers:

Video Compression Service

The package now includes comprehensive video compression capabilities using FFmpeg to convert and optimize video files.

Prerequisites:

Configuration:

Using Video Compression in Forms:

Convenience Helper Methods:

The package provides two convenient helper methods that configure all video settings with a single call:

toWebm() - Optimized for web delivery with WebM format:

toMp4() - Universal compatibility with MP4 format:

Programmatic Video Compression:

Async Video Processing with Queue:

Bulk Video Compression Command:

Video Format Recommendations:

Format Video Codec Audio Codec Use Case Pros Cons
WebM VP9 Opus Modern web Better compression, open source Limited browser support (no Safari)
WebM VP8 Vorbis Legacy web Wider browser support Larger files than VP9
MP4 H.264 AAC Universal Maximum compatibility Larger files, licensing
MP4 H.265/HEVC AAC High quality 50% smaller than H.264 Limited browser support

Preset Performance Guide:

CRF (Constant Rate Factor) Guidelines:

Queue Jobs

The package uses queued jobs for better performance. Jobs are dispatched to configurable queues.

Queue Configuration

Configure queue names in config/file-manager.php:

Running Queue Workers

If using Laravel Horizon (recommended for production): You might have to configure horizon to use supervisors as your requirements. Check horizon's docs for more info on how to configure queues.

If NOT using Horizon, you must explicitly specify the queues:

⚠️ Important: If you're using a database queue driver without Horizon and don't specify the queue names, jobs on non-default queues will not be processed!

Available Jobs

Artisan Commands

The package provides several powerful Artisan commands for managing your media files and metadata:

Command Purpose Key Features
file-manager:manage-sizes Add/remove image sizes for all media Config checking, batch processing, dry run
file-manager:refresh-all Queue refresh jobs for all media Metadata sync, dimension updates, batch jobs
file-manager:populate-seo-titles Generate SEO titles for media files Dry run, model filtering, chunked processing
file-manager:update-seo-titles Update SEO titles when models change Model-specific updates, automatic tracking
file-manager:populate-metadata Create metadata for existing images Auto-fixes MIME types, progress tracking
file-manager:remove-duplicates Remove duplicate metadata records Safe cleanup, dry run preview
file-manager:update-cache-headers Add cache headers to existing S3 images Directory-specific, progress tracking
file-manager:cleanup-old-media Delete old media files from storage Age threshold, PrunableMedia trait, dry run

Manage Image Sizes

Add or remove image sizes for all media files in the media_metadata table. This command is useful when you need to add a new size to your configuration or clean up unused sizes.

Adding a New Size

Removing an Existing Size

Key Features

Important Notes

Example Output

Blocked when size not in config:

Success after adding to config:


Refresh All Media

Queue refresh jobs to update metadata for all media files. This command checks file metadata, dimensions, and synchronizes database records with actual file states in S3 storage.

What It Checks

Key Features

Example Output

GUI Alternative

You can also use the "Refresh All (Queued)" bulk action in the MediaMetadata admin panel to refresh selected records through the UI.


Populate SEO Titles

Generate SEO-optimized titles for existing media files based on their parent model data:

Features:

Update SEO Titles

Update SEO titles when parent model data changes:

Automatic Updates with HasMultimedia Trait

The HasMultimedia trait now includes automatic SEO title updates. Simply define which field to use for SEO titles in your model:

The HasMultimedia trait now provides:

How SEO Titles Work:

Important Notes:

Example for different models:

Populate Media Metadata

If you have existing images in your database before installing this package, you can populate their metadata:

Improvements in the latest version:

This command will:

  1. Scan configured models that use the HasMultimedia trait
  2. Process records in batches to avoid memory issues
  3. Create MediaMetadata records for existing images
  4. Automatically fix incorrect MIME types for existing records
  5. Dispatch jobs to handle large datasets efficiently
  6. Extract file information including size, mime type, and dimensions

MIME Type Detection

The package includes robust MIME type detection that:

This ensures that files like .webp are correctly identified as image/webp and not incorrectly labeled as image/avif or binary/octet-stream.

Remove Duplicate Media Metadata

Clean up duplicate media metadata records from your database:

What it does:

Features:

Example output:

This command is useful when:

Update Cache Headers for Existing Images

Retroactively add cache control headers to existing images in S3:

Features:

How it works:

This command is essential if you have images uploaded before cache headers were implemented, ensuring all your images benefit from optimal browser and CDN caching.

💡 Tip: Verifying Cache Headers

To check if cache headers are properly set on your images, use curl:

Helper Functions

Advanced Usage

Custom Image Sizes

Define custom sizes in your config:

Disabling Automatic Resizing

To completely disable automatic image resizing, set the image_sizes config to an empty array:

This is useful when:

Exclude Certain Fields from Processing

The HasMultimedia trait automatically determines the appropriate processing based on field type:

Handling Nested Arrays

For complex data structures like checkout items:

Troubleshooting

Images not resizing

Duplicate resize jobs

WebP conversion failing

Cloudflare R2 Specific Issues

Connection Errors

Public Access Not Working

Upload Failures

AWS S3 Specific Issues

Access Denied Errors

CORS Issues

Slow Upload/Download

Performance Tips

  1. Use queues for image processing to avoid blocking requests
  2. Enable compression for automatic file size optimization
  3. Configure CDN for faster content delivery
  4. Set appropriate thresholds to avoid compressing small files
  5. Use WebP format for 25-35% smaller file sizes
  6. Configure cache headers for optimal browser and CDN caching:
    • Set max_age to 31536000 (1 year) for versioned/hashed filenames
    • Use public visibility for CDN caching
    • Enable immutable for static assets that never change

Cache Control Configuration

The package automatically adds cache headers to all uploaded media files for optimal performance:

All media files uploaded to S3 will automatically include these cache headers:


Cleanup Old Media

The package provides a cleanup command to delete old media files from storage based on age thresholds. This helps manage storage costs and keep your S3/R2 bucket clean.

How It Works

  1. Apply the PrunableMedia trait to models that have media files
  2. Define prunableMediaPeriod() to specify how old files should be before deletion
  3. The command discovers all models with the trait and deletes their old files from storage
  4. The storage_deleted_at timestamp is set on media_metadata records to track cleanup state

Prerequisites

Add the storage_deleted_at column to your media_metadata table by publishing and running the migration:

Step 1: Apply the Trait

Add PrunableMedia trait to any model that has media files you want to clean up. The model must also use HasMultimedia:

Step 2: Run the Cleanup Command

What Gets Deleted

The command:

  1. Finds all models where created_at is older than the prunableMediaPeriod() threshold
  2. Collects all file paths from the model's mediaFieldsToWatch() fields
  3. Uses FileManagerService::deleteImage() to delete each file — including all resized variants
  4. Sets storage_deleted_at = now() on the corresponding media_metadata records

The command is idempotent — re-running it skips records that already have storage_deleted_at set.

Scheduling

Add to your app/Console/Kernel.php to run weekly:

Or run manually via cron:

API Method

You can also call the cleanup logic directly from PHP:

Key Features

Changelog

Please see CHANGELOG for recent changes.

Contributing

Contributions are welcome! Please see CONTRIBUTING for details.

Security

If you discover any security issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Support

For support, please open an issue on GitHub.


All versions of file-manager with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
filament/filament Version ^5.0
illuminate/contracts Version ^11.0||^12.0||^13.0
illuminate/support Version ^11.0||^12.0||^13.0
intervention/image Version ^3.9
league/flysystem-aws-s3-v3 Version ^3.29
php-ffmpeg/php-ffmpeg Version ^1.2
spatie/laravel-package-tools Version ^1.16
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 rayzenai/file-manager contains the following files

Loading the files please wait ...