定制 zfegg/attachment-handler 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zfegg/attachment-handler

最新稳定版本:v0.2.1

Composer 安装命令:

composer require zfegg/attachment-handler

包简介

附件上传组件

README 文档

README

GitHub Actions: Run tests Coverage Status Latest Stable Version

附件上传处理器

安装 / 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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-23