besanek / laravel-alias-storage by besanek

38,756
2
2
Package Data
Maintainer Username: besanek
Maintainer Contact: robert@jelen.dev (Robert Jelen)
Package Create Date: 2019-05-09
Package Last Update: 2024-04-24
Home Page:
Language: PHP
License: BSD-3-Clause
Last Refreshed: 2024-12-15 15:22:43
Package Statistics
Total Downloads: 38,756
Monthly Downloads: 955
Daily Downloads: 46
Total Stars: 2
Total Watchers: 2
Total Forks: 4
Total Open Issues: 0

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!