miladimos/laravel-filemanager

一个强大、灵活的Laravel文件管理器

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

This package is auto-updated.

Last update: 2024-08-30 01:32:18 UTC


README

Starts Forks

开发中

帮助我们开发吧 :)

在项目根目录下安装,请按照以下步骤操作

composer require miladimos/laravel-filemanager
  1. 打开您的config/app.php并添加以下行
// in providers
Miladimos\FileManager\Providers\FileManagerServiceProvider::class,

// in aliases
Miladimos\FileManager\Facades\FileManagerFacade::class,
  1. 运行以下命令以安装包
php artisan filemanager:install

配置!非常重要!

接下来进入文件

config/filemanager.php;

为了初始化文件管理器,首先设置以下配置

  1. 设置上传文件的默认存储位置(默认为:local)
  2. 设置文件管理器的基准目录名称(默认为:filemanager/)

然后运行以下命令以初始化

php artisan filemanager:init

然后创建表

php artisan migrate

就是这样 :)

如果您已设置公开磁盘,请运行以下命令

php artisan storage:link

如果您想使用FTP,请在您的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,
],

对于sftp使用这个

'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,
],

功能 ❤️

您可以使用您喜欢的任何东西 😎(您可以在编码中使用服务,或使用API为您的图形文件管理器或任何其他内容...)

后端服务

目录服务
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();

通过后端服务提供API

对于所有请求,设置以下头信息

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

  • 目录服务 - 列表、递归列表、创建、删除、移动
  • 文件服务 - 列表、删除、移动
  • 上传服务 -
  • 图片服务 -
  • 文件组服务 -
  • 归档服务 - zip、tar

FRONTEND TODO

  • Web视图 -