PHPackages                             shopwwi/webman-filesystem - 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. shopwwi/webman-filesystem

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

shopwwi/webman-filesystem
=========================

Flysystem V2 adapter for the webman

v2.0.1(11mo ago)2715.4k—0%3MITPHPPHP &gt;=7.2

Since Dec 25Pushed 11mo agoCompare

[ Source](https://github.com/shopwwi/webman-filesystem)[ Packagist](https://packagist.org/packages/shopwwi/webman-filesystem)[ RSS](/packages/shopwwi-webman-filesystem/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

[!['Build Status'](https://camo.githubusercontent.com/e97a3485859e3e58fa24ebc49223daf795318633dd46ef77d36eed10d1e2623d/68747470733a2f2f7472617669732d63692e6f72672f73686f707777692f7765626d616e2d66696c6573797374656d2e7376673f6272616e63683d6d61696e)](https://github.com/shopwwi/webman-filesystem) [!['Latest Stable Version'](https://camo.githubusercontent.com/94a3e0b4210159765eaac94b1ca962aa6d34cc7f0239277a4d963306d2e7e7e8/68747470733a2f2f706f7365722e707567782e6f72672f73686f707777692f7765626d616e2d66696c6573797374656d2f762f737461626c652e737667)](https://packagist.org/packages/shopwwi/webman-filesystem) [!['Total Downloads'](https://camo.githubusercontent.com/8a68259f67c91d0a786cda31e10cbfc34ef31708438d3b6c434289861e1f6d3a/68747470733a2f2f706f7365722e707567782e6f72672f73686f707777692f7765626d616e2d66696c6573797374656d2f642f746f74616c2e737667)](https://packagist.org/packages/shopwwi/webman-filesystem) [!['License'](https://camo.githubusercontent.com/25dbd97d5dd9f4c526122001b498876d72c0ce6d887f8e6d6c8322fb921536ae/68747470733a2f2f706f7365722e707567782e6f72672f73686f707777692f7765626d616e2d66696c6573797374656d2f6c6963656e73652e737667)](https://packagist.org/packages/shopwwi/webman-filesystem)

- 如果觉得方便了你，给个小星星鼓励一下吧
- 如果你遇到问题 可以给我发邮件

安装
==

[](#安装)

```
composer require shopwwi/webman-filesystem

```

使用方法
----

[](#使用方法)

- 阿里云 OSS 适配器(php7.X)

```
composer require "iidestiny/flysystem-oss:^3"

```

- 阿里云 OSS 适配器(php8.X)

```
composer require "iidestiny/flysystem-oss:^4"

```

- S3 适配器

```
composer require "league/flysystem-aws-s3-v3:^3.0"

```

- 七牛云适配器(php7.X)

```
composer require "overtrue/flysystem-qiniu:^2.0"

```

- 七牛云适配器(php8.X)

```
composer require "overtrue/flysystem-qiniu:^3.0"

```

- 内存适配器

```
composer require "league/flysystem-memory:^3.0"

```

- 腾讯云 COS 适配器(php7.x)

```
composer require "overtrue/flysystem-cos:^4.0"

```

- 腾讯云 COS 适配器(php8.x)

```
composer require "overtrue/flysystem-cos:^5.0"

```

使用
==

[](#使用)

通过FilesystemFactory::get('local') 来调用不同的适配器

```
    use Shopwwi\WebmanFilesystem\FilesystemFactory;
    public function upload(Request $request)
    {
        $file = $request->file('file');

        $filesystem =  FilesystemFactory::get('local');
        $stream = fopen($file->getRealPath(), 'r+');
        $filesystem->writeStream(
            'uploads/'.$file->getUploadName(),
            $stream
        );
        fclose($stream);

        // Write Files
        $filesystem->write('path/to/file.txt', 'contents');

        // Add local file
        $stream = fopen('local/path/to/file.txt', 'r+');
        $result = $filesystem->writeStream('path/to/file.txt', $stream);
        if (is_resource($stream)) {
            fclose($stream);
        }

        // Update Files
        $filesystem->update('path/to/file.txt', 'new contents');

        // Check if a file exists
        $exists = $filesystem->has('path/to/file.txt');

        // Read Files
        $contents = $filesystem->read('path/to/file.txt');

        // Delete Files
        $filesystem->delete('path/to/file.txt');

        // Rename Files
        $filesystem->rename('filename.txt', 'newname.txt');

        // Copy Files
        $filesystem->copy('filename.txt', 'duplicate.txt');

        // list the contents
        $filesystem->listContents('path', false);
    }
```

便捷式上传
=====

[](#便捷式上传)

- 支持base64图片上传
- 支持设定重复文件上传及文件覆盖
- 支持指定文件名上传及文件覆盖
- 新增图片处理器上传 （附加于强大的海报生成/图片压缩/水印等）新增V3版本
- 修复文件后缀大小写问题 统一小写

```
    use Shopwwi\WebmanFilesystem\Facade\Storage;
    public function upload(\support\Request $request){
         // 适配器 local默认是存储在runtime目录下 public默认是存储在public目录下
         // 可访问的静态文件建议public
         // 默认适配器是local
         Storage::adapter('public');
        //单文件上传
        $file = $request->file('file');
        // 上传第二参数默认为true即允许相同文件的上传 为false时将会覆盖原文件
        $result = Storage::upload($file,false);
        //单文件判断
        try {
            $result = Storage::adapter('public')->path('storage/upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->upload($file);
         }catch (\Exception $e){
            $e->getMessage();
         }

         //多文件上传
         $files = $request->file();
         $result = Storage::uploads($files);
         try {
         //uploads 第二个参数为限制文件数量 比如设置为10 则只允许上传10个文件 第三个参数为允许上传总大小 则本列表中文件总大小不得超过设定 第四参数默认为true即允许同文件上传 false则为覆盖同文件
            $result = Storage::adapter('public')->path('storage/upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->uploads($files,10,1024*1024*100);
         }catch (\Exception $e){
            $e->getMessage();
         }

        // 指定文件名上传(同文件将被覆盖)
        try {
            $files = $request->file();
            $fileName = 'storage/upload/user/1.png'; // 文件名中如此带了路径 则下面的path无效 未带路径1.png效果相等
            $ext = true; // 文件尾缀是否替换 开启后则$files上传的任意图片 都会转换为$fileName尾缀（示例: .png），默认false
            $result = Storage::adapter('public')->path('storage/upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->reUpload($file,$fileName,$ext);
         }catch (\Exception $e){
            $e->getMessage();
         }

        // base64图片上传
        try {
            $files = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAHCCAYAAAB8GMlFAAAAAXNSR0IArs4c6QAAAARnQU1BAACx...";
            $result = Storage::adapter('public')->path('storage/upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->base64Upload($files);
         }catch (\Exception $e){
            $e->getMessage();
         }

        // 强大的图片处理 你甚至可以创建画报直接保存
        // 在使用前 请确保你安装了 composer require intervention/image
        try {
            $files = $request->file();
            $fileName = 'storage/upload/user/1.png'; // 文件名中如此带了路径 则下面的path无效 未带路径1.png效果相等
            $ext = true; // 文件尾缀是否替换 开启后则$files上传的任意图片 都会转换为$fileName尾缀（示例: .png），默认false
            $result = Storage::adapter('public')->path('storage/upload/user')->size(1024*1024*5)->extYes(['image/jpeg','image/gif'])->extNo(['image/png'])->processUpload($file,function ($image){
                // 图片大小更改 resize()
                $image->resize(100,50)
                // 在图片上增加水印 insert()
                $image->insert('xxx/watermark.png','bottom-right',15,10)
                // 当然你可以使用intervention/image 中的任何功能 最终都会上传在你的storage库中
                return $image
            },$ext);
         }catch (\Exception $e){
            $e->getMessage();
         }

         //获取文件外网
         $filesName = 'storage/a4bab140776e0c1d57cc316266e1ca05.png';
         $fileUrl = Storage::url($filesName);
         //指定选定器外网
         $fileUrl = Storage::adapter('oss')->url($filesName);
    }

```

### 静态方法（可单独设定）

[](#静态方法可单独设定)

方法描述默认adapter选定器config中配置的defaultsize单文件大小config中配置的max\_sizeextYes允许上传文件类型config中配置的ext\_yesextNo不允许上传文件类型config中配置的ext\_nopath文件存放路径(非完整路径)storage### 响应字段

[](#响应字段)

字段描述示例值origin\_name源文件名称webman.pngfile\_name文件路径及名称storage/a4bab140776e0c1d57cc316266e1ca05.pngstorage\_key文件随机keya4bab140776e0c1d57cc316266e1ca05file\_url文件访问外网//127.0.0.1:8787/storage/cab473e23b638c2ad2ad58115e28251c.pngsize文件大小22175mime\_type文件类型image/jpegextension文件尾缀jpgwidth图片宽度（图片类型才返回）206height图片高度（图片类型才返回）206

###  Health Score

37

—

LowBetter than 84% of packages

Maintenance50

Moderate activity, may be stable

Popularity36

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.4% 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 ~115 days

Total

5

Last Release

355d ago

Major Versions

v1.1.1 → v2.0.02025-03-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/df539cc9ed77b47bc184c26a9cb989e551f9afb1e8841ea02f25fe66b6b0ee91?d=identicon)[phcent](/maintainers/phcent)

---

Top Contributors

[![phcent](https://avatars.githubusercontent.com/u/70010565?v=4)](https://github.com/phcent "phcent (27 commits)")[![sodos66](https://avatars.githubusercontent.com/u/190682286?v=4)](https://github.com/sodos66 "sodos66 (1 commits)")

---

Tags

filesystemqiniuosscoswebman

### Embed Badge

![Health badge](/badges/shopwwi-webman-filesystem/health.svg)

```
[![Health](https://phpackages.com/badges/shopwwi-webman-filesystem/health.svg)](https://phpackages.com/packages/shopwwi-webman-filesystem)
```

###  Alternatives

[yangyifan/upload

上传 SDK for Laravel

12122.6k3](/packages/yangyifan-upload)[alphasnow/aliyun-oss-flysystem

Flysystem adapter for the Aliyun storage

14240.0k3](/packages/alphasnow-aliyun-oss-flysystem)

PHPackages © 2026

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