Skip to content

A powerful Laravel storage driver that enables seamless synchronization of files across multiple disks, with an integrated cache disk for optimized performance.

License

Notifications You must be signed in to change notification settings

ssntpl/cloud-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloud Driver for Laravel Storage

Latest Version on Packagist Total Downloads

A powerful Laravel storage driver that enables seamless synchronization of files across multiple disks, with an integrated cache disk for optimized performance.

Features

  • Multi-Disk Support: Define multiple remote disks to store your files.
  • Cache Disk: Files are first uploaded to a designated cache disk for quick access.
  • Asynchronous Sync: Files are synced to all remote disks asynchronously, ensuring high availability.
  • Optimized Access: Files are accessed from the cache disk first; if not found, they are retrieved from the remote disks in the defined order.

Installation

Install the package via Composer:

composer require ssntpl/cloud-storage

Usage

  1. Configuration: In your Laravel application's config/filesystems.php, define your disks, including the cache disk.

    'disks' => [
        'cloud_disk' => [
            'driver' => 'cloud',
            'cache_disk' => 'local',
            'remote_disks' => [
                 'remote_disk_1', 
                 'remote_disk_2', 
                 's3', 
                 'minio',
                 // Add more remote disks as needed...
            ],
            'cache_time' => 24, // Time (in hours) to cache files on the cache disk
        ],
    
        // Define other disks (including cache disk, and remote disks used in the cloud disk above)
    ],
  2. Upload Files: When uploading files using this driver, they will first be stored on the cache disk and then asynchronously synced to all defined remote disks.

    Storage::disk('cloud_disk')->put('path/to/file.jpg', $fileContents);
  3. Access Files: The driver will check the cache disk first; if the file isn't found there, it will sequentially check each remote disk as configured.

    $file = Storage::disk('cloud_disk')->get('path/to/file.jpg');

Future Enhancements

  • Improved Sync Strategies: Additional options for sync strategies, such as prioritizing certain disks.
  • Advanced Caching Mechanisms: Enhance caching strategies to improve performance in specific use cases.
  • Monitoring and Alerts: Integrate monitoring for sync failures and performance metrics.

Changelog

Please see CHANGELOG for detailed information on the latest changes.

Security Vulnerabilities

If you discover any security-related issues, please email support@ssntpl.com instead of using the issue tracker.

Credits

License

This package is licensed under the MIT License. See the License File for more details.

About

A powerful Laravel storage driver that enables seamless synchronization of files across multiple disks, with an integrated cache disk for optimized performance.

Topics

Resources

License

Stars

Watchers

Forks

Languages