miladimos/laravel-filemanager

a powerful, flexible laravel file manager

v0.6.4 2021-11-22 22:38 UTC

This package is auto-updated.

Last update: 2024-11-30 01:57:47 UTC


README

Starts Forks

Under Development

help us for development :)

for installation in root of your project do these steps:

composer require miladimos/laravel-filemanager
  1. Open your config/app.php and add the following lines:
// in providers
Miladimos\FileManager\Providers\FileManagerServiceProvider::class,

// in aliases
Miladimos\FileManager\Facades\FileManagerFacade::class,
  1. 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:

  1. set default storage to upload file (default is: local)
  2. 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 -