onix-systems-php/hyperf-file-upload
Composer 安装命令:
composer require onix-systems-php/hyperf-file-upload
包简介
An extension to maintain file upload and assignation
README 文档
README
Includes the following classes:
- Model:
- File;
- FileRelations trait.
- Repository:
- FileRepository.
- Service:
- AddExternalFileService;
- AddFileService;
- ClearUnusedDeletedFilesService;
- DownloadFileService.
Install:
composer require onix-systems-php/hyperf-file-upload
Publish config and database migrations:
php bin/hyperf.php vendor:publish onix-systems-php/hyperf-file-upload
Fill file_upload config with file upload configuration, following existing examples.
Add $fileRelations config and FileRelations trait to models you want assign files to:
use FileRelations; public $fileRelations = [ 'avatar' => [ 'limit' => 1, 'required' => false, 'mimeTypes' => [image/png', 'image/jpg', 'image/jpeg', 'image/bmp'], 'presets' => [ '150x150' => ['fit' => [150, 150]], '250x250' => ['fit' => [250, 250]], ], ], 'documents' => [ 'limit' => null, 'required' => false, 'mimeTypes' => ['application/pdf'], ], ];
Methods you might need to redefine in FileRelations trait:
getAuth: this method should return active userprocessFileActions: if you defined new extra actions in config, you'll need to define action's login in this method
统计信息
- 总下载量: 2.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-23