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
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,
],
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 ...)
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
use Miladimos\FileManager\Services\FileService;
$service = new FileService(); // or resolve(FileService::class)
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);
use Miladimos\FileManager\Services\ImageService;
$service = new ImageService();
use Miladimos\FileManager\Services\UploadService;
$service = new UploadService();
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
- Directory service - list, list recursive, create, delete, move
- File service - list, delete, move
- Upload service -
- Image service -
- FileGroup service -
- Archive service - zip, tar
- Web view -