PHPackages                             zfegg/attachment-handler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. zfegg/attachment-handler

ActiveLibrary[File &amp; Storage](/categories/file-storage)

zfegg/attachment-handler
========================

附件上传组件

v0.2.1(10mo ago)0241MITPHPPHP &gt;=8.0CI failing

Since Jul 23Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/zfegg/attachment-handler)[ Packagist](https://packagist.org/packages/zfegg/attachment-handler)[ RSS](/packages/zfegg-attachment-handler/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (15)Versions (6)Used By (1)

附件上传处理器
=======

[](#附件上传处理器)

[![GitHub Actions: Run tests](https://github.com/zfegg/attachment-handler/workflows/qa/badge.svg)](https://github.com/zfegg/attachment-handler/actions?query=workflow%3A%22qa%22)[![Coverage Status](https://camo.githubusercontent.com/f2297d16ade7659785f1820899e9335e22cbe68502fe4dc697ac2c57a4ca639e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7a666567672f6174746163686d656e742d68616e646c65722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/zfegg/attachment-handler?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/ded96eb2f0a140a1c1ce03a2507bfc6dcdd2bf07c201a15da66d81aa25d1e6cc/68747470733a2f2f706f7365722e707567782e6f72672f7a666567672f6174746163686d656e742d68616e646c65722f762f737461626c652e706e67)](https://packagist.org/packages/zfegg/attachment-handler)

附件上传处理器

安装 / Installation
-----------------

[](#安装--installation)

```
composer require zfegg/attachment-handler
```

使用 / Usage
----------

[](#使用--usage)

### 在Mezzio中使用

[](#在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'
    ]
]
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance54

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~179 days

Total

5

Last Release

314d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2050694?v=4)[Moln](/maintainers/Moln)[@Moln](https://github.com/Moln)

---

Top Contributors

[![Moln](https://avatars.githubusercontent.com/u/2050694?v=4)](https://github.com/Moln "Moln (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zfegg-attachment-handler/health.svg)

```
[![Health](https://phpackages.com/badges/zfegg-attachment-handler/health.svg)](https://phpackages.com/packages/zfegg-attachment-handler)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)[thecodingmachine/graphqlite

Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).

5723.1M30](/packages/thecodingmachine-graphqlite)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[neos/flow-development-collection

Flow packages in a joined repository for pull requests.

144179.3k3](/packages/neos-flow-development-collection)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
