miladimos / laravel-filemanager
a powerful, flexible laravel file manager
Fund package maintenance!
idpay.ir/laravelir
Requires
- php: >=7.4|^8
- intervention/image: ^2.6
- league/mime-type-detection: ^1.7
- morilog/jalali: >=v3.1.0
- nesbot/carbon: ^2.50.0
- ramsey/uuid: ^4.1
- webpatser/laravel-uuid: ^4
README
Under Development
help us for development :)
for installation in root of your project do these steps:
composer require miladimos/laravel-filemanager
- Open your config/app.php and add the following lines:
// in providers Miladimos\FileManager\Providers\FileManagerServiceProvider::class, // in aliases Miladimos\FileManager\Facades\FileManagerFacade::class,
- Run the command below to install package:
php artisan filemanager:install
Configuration ! important !
next go to the file
config/filemanager.php;
for initialize file manager first set these confings:
- set default storage to upload file (default is: local)
- set base directory name for file manager (default is: filemanager/)
and run bellow command for initialize:
php artisan filemanager:init
then create tables:
php artisan migrate
just it :)
if you are set public disk run bellow command:
php artisan storage:link
and if you want use ftp add these config in your config/filesystems.php:
'ftp' => [ 'driver' => 'ftp', 'host' => 'ftp.example.com', 'username' => 'your-username', 'password' => 'your-password', // Optional FTP Settings... // 'port' => 21, // 'root' => '', // 'passive' => true, // 'ssl' => true, // 'timeout' => 30, ],
and for sftp use this:
'sftp' => [ 'driver' => 'sftp', 'host' => 'example.com', 'username' => 'your-username', 'password' => 'your-password', // Settings for SSH key based authentication... 'privateKey' => '/path/to/privateKey', 'password' => 'encryption-password', // Optional SFTP Settings... // 'port' => 22, // 'root' => '', // 'timeout' => 30, ],
Features ❤️
You are free to use whatever you like 😎 ( you can just use services in your coding or use apis for your graphical file manager or whatever ...)
Backend Services:
Directory service:
use Miladimos\FileManager\Services\DirectoryService; $service = new DirectoryService(); $service->createDirectory($name); // name of directory for create $service->deleteDirectory($uuid); // uuid of directory for delete in db and disk $service->listDirectories($path) // list all directories in given path $service->listDirectoriesRecursive($path); // list all directories in given path Recursively
File service:
use Miladimos\FileManager\Services\FileService; $service = new FileService(); // or resolve(FileService::class)
FileGroup service:
use Miladimos\FileManager\Services\FileGroupService; $service = new FileGroupService(); $service->allFileGroups(); $service->createFileGroup(array $data); // $data = ['title', 'description'] $service->updateFileGroup(FileGroup $fileGroup, array $data); // $data = ['title', 'description'] $service->deleteFileGroup(FileGroup $fileGroup);
Image service:
use Miladimos\FileManager\Services\ImageService; $service = new ImageService();
Upload service:
use Miladimos\FileManager\Services\UploadService; $service = new UploadService();
API over backend services:
for all requests set these headers:
Content-Type : application/x-www-form-urlencoded
prefix = /api_prefix/filemanager_api_version/route_prefix
// Directories
POST -> prefix/directories // store new directory
DELETE -> prefix/directories // receive directories field: it can be array of uuid or one uuid of directories for delete
// File Groups
GET -> prefix/filegroups // return all available file groups
POST -> prefix/filegroups // store new file groups -> receive : title, description
PUT -> prefix/filegroups/{filegroup}/update // update file groups -> receive : title, description
DELETE -> prefix/filegroups/{filegroup} // delete file groups
BACKEND TODO:
- Directory service - list, list recursive, create, delete, move
- File service - list, delete, move
- Upload service -
- Image service -
- FileGroup service -
- Archive service - zip, tar
FRONTEND TODO:
- Web view -