Laravel package to manage storage and it's mapping
yuyu-tech/file-manager is a Laravel package for laravel package to manage storage and it's mapping.
It currently has 0 GitHub stars and 1.386 downloads on Packagist (latest version 2.1.4).
Install it with composer require yuyu-tech/file-manager.
Discover more Laravel packages by yuyu-tech
or browse all Laravel packages to compare alternatives.
Last updated
To manage storage access for s3 & local filesystem
# In your Laravel Project
$ composer require yuyu-tech/file-manager
# Publish package resourceses using
$ php artisan vendor:publish --provider="Yuyu\FileManager\Providers\FileManagerServiceProvider"
#To migrate package resources
$ php artisan migrate --path=database/migration/2019_10_24_090016_create_attachments_table.php
# For ease of use for local storage, create the symbolic link for storage directory using
# Not require for S3 storage
$ php artisan storage:link
We can generate instance of FileManagerController using below ways.
use FileManager;
$objFileManager = new FileManager;
use \Yuyu\FileManager\Controllers\FileManagerController;
$objFileManager = new FileManagerController;
$objFileManager = app('fileManager');
We can store eiter file content or UploadedFile object directly.
$objAttachment = FileManager::storeFile($request->file, $user, 'profilePicture', '/user/profile-picture/');
$objAttachment = FileManager::storeContent($content, $strFileName, $strMimeType, $strExtension, $user, 'profilePicture', $strPath='user/profile-picture');
// Generate a view URL for attachment id 1 which will expire after 50 Minutes.
$strViewUrl = FileManager::getAccessUrl(1, 'view', 50);
// Generate a download URL for attachment id 1 which will never expire
// Here to generate never expire URL we will pass a biggest value for expire after parameter.
$strViewUrl = FileManager::getAccessUrl(1, 'download', 99999999999);