PHPackages                             phpyii/php-storage - 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. phpyii/php-storage

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

phpyii/php-storage
==================

上传文件

v1.0.0(5y ago)061MITPHPPHP &gt;=7.1.0

Since Sep 15Pushed 5y ago1 watchersCompare

[ Source](https://github.com/phpyii/php-storage)[ Packagist](https://packagist.org/packages/phpyii/php-storage)[ Docs](https://github.com/phpyii/php-storage)[ RSS](/packages/phpyii-php-storage/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

php-storage
===========

[](#php-storage)

文件上传

简介
==

[](#简介)

php-storage PHP多存储驱动的文件管理类，支持多种云存储平台。

支持平台
====

[](#支持平台)

- 本地服务器
- 腾讯云 COS
- 阿里云 OSS
- 七牛云存储
- 又拍云存储

环境支持
====

[](#环境支持)

php版本 &gt;= PHP 7.1

安装
--

[](#安装)

```
composer require phpyii/php-storage

//开发版本
composer require phpyii/php-storage:dev-master

```

使用方法
====

[](#使用方法)

```
 $file = new FileObject();

 //本地存储
 $file->setDriver([
     'type' => 'local',
     'config' => [
         'domain' => 'http://www.baidu.com',
         'save_path' => 'E:/',
     ],
 ]);

 //腾讯cos
 //$file->setDriver([
 //    'type' => 'cos',
 //    'config' => [
 //        'secret_id' => '',
 //        'secret_key' => '',
 //        'app_id' => '',
 //        'bucket' => '',
 //        'region' => 'ap-beijing',
 //        'domain' => '', //留空自动设置
 //        'use_ssl' => false,
 //    ],
 //]);

 //阿里oss
 //$file->setDriver([
 //    'type' => 'oss',
 //    'config' => [
 //        'secret_id' => '',
 //        'secret_key' => '',
 //        'bucket' => '',
 //        'region' => 'oss-cn-hangzhou',
 //        'domain' => '', //留空自动设置
 //        'use_ssl' => false,
 //    ],
 //]);

 //七牛
 //$file->setDriver([
 //    'type' => 'qiniu',
 //    'config' => [
 //        'access_key' => '',
 //        'secret_key' => '',
 //        'bucket' => '',
 //        'domain' => 'http://www.baidu.com',
 //        'api_host' => 'up.qiniup.com',
 //        'use_ssl' => false,
 //    ],
 //]);

 //又拍云
 //$fileObject->setDriver([
 //    'type' => 'upyun',
 //    'config' => [
 //        'operator' => '',
 //        'password' => '',
 //        'bucket' => '',
 //        'domain' => '',
 //        'api_host' => 'v0.api.upyun.com',
 //        'use_ssl' => false,
 //    ],
 //]);

 //其他继承了DriverAbstract类的所有自定义类都可以
 //$customClass = new CustomClass();
 //$file->setDriver($customClass);

 //上传
 //$file->fileTmpPath = 'E:/a.jpg';
 //$file->oldName = 'a.jpg'; //原文件名 可留空
 ////$file->filePath = ''; //带后缀的新文件名称  留空自动生成
 ////$fileObject->fileBase64 = ''; //图片base64字符串 data:image/png;base64,后边的字符串
 ////$file->ext = 'jpg'; //文件后缀 留空自动获取
 ////$file->allowExts = ['png','jpg', 'txt']; //允许的后缀
 ////$file->mime = 'image/jpeg'; //留空通过后缀自动获取
 //$file->saveDir = 'dev/test'; //保存目录
 //$file->dateDir = true; //是否自动追加日期目录
 //$file->isCover = true; //是否覆盖
 ////$file->maxSize = 1048576; //限制文件大小
 //$bool = $file->save();
 //if($bool){
 //    //文件保存路径
 //    //$file->filePath;
 //    //文件访问路径
 //    //$file->fileUrl;
 //}
 // else{
 //    var_dump($file->getMsg());
 // }

 //删除
 //$bool = $file->del('/dev/test/2020/0910/08e87202009101612179540.jpg');
 //或者
 //$file->filePath = '/dev/test/2020/0910/08e87202009101612179540.jpg';
 //$bool = $file->del();

 //文件是否存在
 $bool = $file->has('/dev/test/2020/0910/0e80b202009101613326313.jpg');
 //或者
 //$file->filePath = '/dev/test/2020/0910/08e87202009101612179540.jpg';
 //$bool = $file->has();

 //操作结果
 var_dump($bool);
 //请求结果
 var_dump($file->getResult());
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

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

Unknown

Total

1

Last Release

2071d ago

### Community

Maintainers

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

---

Top Contributors

[![pgyf](https://avatars.githubusercontent.com/u/3365344?v=4)](https://github.com/pgyf "pgyf (17 commits)")

---

Tags

cosossqiniustorageuploadphpfilestorageuploadqiniuosscosupyunphp-storage

### Embed Badge

![Health badge](/badges/phpyii-php-storage/health.svg)

```
[![Health](https://phpackages.com/badges/phpyii-php-storage/health.svg)](https://phpackages.com/packages/phpyii-php-storage)
```

###  Alternatives

[yangyifan/upload

上传 SDK for Laravel

12422.6k3](/packages/yangyifan-upload)[blueimp/jquery-file-upload

File Upload widget for jQuery.

141.5M18](/packages/blueimp-jquery-file-upload)

PHPackages © 2026

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