besanek / laravel-alias-storage by besanek

29,373
2
2
Package Data
Maintainer Username: besanek
Maintainer Contact: robert@jelen.dev (Robert Jelen)
Package Create Date: 2019-05-09
Package Last Update: 2024-03-02
Home Page:
Language: PHP
License: BSD-3-Clause
Last Refreshed: 2024-04-18 15:27:42
Package Statistics
Total Downloads: 29,373
Monthly Downloads: 1,218
Daily Downloads: 49
Total Stars: 2
Total Watchers: 2
Total Forks: 4
Total Open Issues: 1

Laravel Alias Storage

Meta filesystem, witch you can acreate aliases for other filesystems.

Requirement

  • PHP >= 7.1
  • Laravel >= 5.5

Installing

$ composer require "besanek/laravel-alias-storage"

Basic Usage

<?php // config/filesystems.php

return [
    'something' => [
        'driver' => 'alias',
        'target' => 'local',
    ],
];

In that case, calling Storage::disk('something') will returns local filesystem.

Real life use case

<?php // config/filesystems.php

return [
    'video' => [
        'driver' => 'alias',
        'target' => env('VIDEO_STORAGE', 'local'),
    ],
    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
    ],
    's3' => [
        'driver' => 's3',
        // config ...
    ]
];

In local development, you can store videos in local filesystem. But in production, you can set environment VIDEO_STORAGE=s3 and your video uploads are stored and served from S3. Awesome!