zfegg/attachment-handler
最新稳定版本:v0.2.1
Composer 安装命令:
composer require zfegg/attachment-handler
包简介
附件上传组件
README 文档
README
附件上传处理器
安装 / Installation
composer require zfegg/attachment-handler
使用 / Usage
在Mezzio中使用
// File config/config.php // Add ConfigProvider new ConfigAggregator([ Zfegg\AttachmentHandler\ConfigProvider::class, ]);
配置示例:
use Zfegg\AttachmentHandler\AttachmentHandler; use League\Flysystem\Filesystem; return [ AttachmentHandler::class => [ 'rules' => [ 'UploadExtension' => [ 'options' => ['allowed' => ['jpg', 'jpeg', 'png', 'gif', 'bmp']], 'messageTemplate' => '文件必须为图片格式 (jpg, jpeg, png, gif, bmp)', ], 'UploadSize' => [ 'options' => ['size' => '2M'], 'messageTemplate' => '上传文件必须小于 {max}' ], ], 'storage' => 'images/{date}/{uniqid}.{ext}', 'url' => '/uploads' ], Filesystem::class => [ // 上传目录,支持 url schema // ftp://user:pass@127.0.0.1/uploads // sftp://user:pass@127.0.0.1/uploads // memory://temp 'path' => 'public/uploads' ] ]
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-23