PHPackages                             liz/flysystem-qiniu - 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. liz/flysystem-qiniu

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

liz/flysystem-qiniu
===================

QiNiu oss adapter for flysystem

v1.23(5y ago)443.3k↓25%[1 issues](https://github.com/l396635210/flysystem-qiniu/issues)14MITPHPPHP ^7.0 || ^8.0

Since Dec 13Pushed 4y ago1 watchersCompare

[ Source](https://github.com/l396635210/flysystem-qiniu)[ Packagist](https://packagist.org/packages/liz/flysystem-qiniu)[ RSS](/packages/liz-flysystem-qiniu/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (24)Used By (14)

由于作原因，没有时间维护。请使用[overtrue/flysystem-qiniu](https://github.com/overtrue/flysystem-qiniu)
=======================================================================================

[](#由于作原因没有时间维护请使用overtrueflysystem-qiniu)

QiNiu OSS(七牛云对象存储) Adapter For Flysystem.
-----------------------------------------

[](#qiniu-oss七牛云对象存储-adapter-for-flysystem)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Flysystem 适配器： [七牛云](https://www.qiniu.com/)

Installation
------------

[](#installation)

composer require liz/flysystem-qiniu

Usage
-----

[](#usage)

```
require 'vendor/autoload.php';

use League\Flysystem\Filesystem;
use Liz\Flysystem\QiNiu\Plugins\PrivateDownloadUrlMaker;
use Liz\Flysystem\QiNiu\Plugins\TransCoder;
use Liz\Flysystem\QiNiu\QiNiuOssAdapter;
use Liz\Flysystem\QiNiu\QiNiuOssAdapterException;

# cdn [外链默认域名须英文](https://developer.qiniu.com/kodo/kb/5158/how-to-transition-from-test-domain-name-to-a-custom-domain-name)
$cdnHost = 'cdn.host.com';
# bucket [七牛对象存储空间列表](https://portal.qiniu.com/bucket)
$bucket = 'bucket';
# $accessKey [用户密钥](https://portal.qiniu.com/user/key)
$accessKey = 'access-key';
$secretKey = 'secret-key';

$flysystem = new Filesystem(new QiNiuOssAdapter($accessKey, $secretKey, $bucket, $cdnHost));
try {

// 创建文件夹
    $result = $flysystem->createDir('path/dir');
var_dump($result);
// 删除文件夹
    $result = $flysystem->deleteDir('path/dir');
var_dump($result);
// has file
    $isExist = $flysystem->has('path/file.txt');
// write file
    if (!$isExist){
        $result = $flysystem->write('path/file.txt', 'contents');
        var_dump($result);
    }

// write stream
    if (!$flysystem->has('path/filename.txt')){
        $stream = fopen('.gitignore', 'r+');
        $result = $flysystem->writeStream('path/file name.txt', $stream);
        var_dump($result);
        $result = $flysystem->read('path/file name.txt');
        var_dump($result);
    }

// update file
    $result = $flysystem->update('path/file.txt', 'new contents');
var_dump($result);
// read file
    $result = $flysystem->read('path/file.txt');
var_dump($result);
// rename files
    if(!$flysystem->has('path/newname.txt')){
        $result = $flysystem->rename('path/file name.txt', 'path/newname.txt');
        var_dump($result);
    }

// copy files
    if (!$flysystem->has('path/file_copy.txt')){
        $result = $flysystem->copy('path/file.txt', 'path/file_copy.txt');
    }

// list the contents
    $result = $flysystem->listContents('path', false);
    var_dump($result);
// delete file
    $result = $flysystem->delete('path/file.txt');
var_dump($result);
// 转码
    /**
     * @var $flysystem Filesystem|QiNiuOssAdapter
     */
    $flysystem = new Filesystem(new QiNiuOssAdapter($accessKey, $secretKey, $bucket, $cdnHost));

    /**
     * TransCoder constructor.
     * @param null $notifyUrl 处理完毕默认通知地址
     * @param null $pipeLine 默认队列名称 https://portal.qiniu.com/dora/mps/new
     * @param null $toBucket 处理完成默认保存到的bucket
     * @param null $wmImage 水印图片地址
     */
    $flysystem->addPlugin(new TransCoder('notify_url', 'pipeline', 'toBucket', 'wmImage')); //设置转码默认选项

    // 转码样式说明 https://developer.qiniu.com/kodo/kb/5858/the-instructions-on-the-storage-space-of-transcoding-style
    $rules = 'm3u8/segtime/10/ab/128k/ar/44100/acodec/libfaac/r/30/vb/640k/vcodec/libx264/stripmeta/0/noDomain/1';

    /**
     * @param $path 待转码文件路径
     * @param $rules 转码规则[转码规则说明](https://developer.qiniu.com/kodo/kb/5858/the-instructions-on-the-storage-space-of-transcoding-style)
     * @param null $pipeline 队列名称,若不填写使用TransCoder初始化的pipeline https://portal.qiniu.com/dora/mps/new
     * @param null $notifyUrl 处理完毕通知地址,若不填写使用TransCoder初始化的bucket
     * @param null $saveAs 保存全部路径，若不填写则为$path的名称加_trans
     * @param null $bucket 处理完成保存到bucket，若不填写则使用TransCoder初始化的bucket
     *
     * @return array
     *
     * @throws QiNiuOssAdapterException
     */
    $result = $flysystem->transCoding('xxw-community/a.mp4', $rules,  'xxw-community/a.m3u8', 'notify_url', 'first', 'to_bucket');
    var_dump($result);

//获取私有下载地址
    $flysystem->addPlugin(new PrivateDownloadUrlMaker());
    /**
     * @param string $baseUrl 请求url
     * @param bool $isBucketPrivate bucket是否为私有，如果是私有m3u8文件会对相关ts文件进行授权处理(https://developer.qiniu.com/dora/api/1292/private-m3u8-pm3u8)
     * @param int $expires
     * @return string
     */
    $url = $flysystem->privateDownloadUrl('xxw-community/a.m3u8', true);
    var_dump($url);

//获取上传token
    $flysystem->addPlugin(new UploadTokenMaker());
    $token = $flysystem->getUploadToken('upload/token/file.txt');
    var_dump($token);

}catch (Exception $exception){
    echo "";
    var_dump($exception);
}
```

Notice
------

[](#notice)

`getVisibility()`,`setVisibility()`七牛云没有提供相关操作，只能对整个bucket进行私有或公共访问的操作

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity76

Established project with proven stability

 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 ~34 days

Recently: every ~109 days

Total

23

Last Release

1944d ago

PHP version history (2 changes)v1.0PHP ^7.0

v1.23PHP ^7.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ce588a9a1661fcaab1409876f8dde4e75b8b1fb95f5c7a09220439f6119d569?d=identicon)[l396635210](/maintainers/l396635210)

---

Top Contributors

[![l396635210](https://avatars.githubusercontent.com/u/16893909?v=4)](https://github.com/l396635210 "l396635210 (30 commits)")

### Embed Badge

![Health badge](/badges/liz-flysystem-qiniu/health.svg)

```
[![Health](https://phpackages.com/badges/liz-flysystem-qiniu/health.svg)](https://phpackages.com/packages/liz-flysystem-qiniu)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M788](/packages/league-flysystem-aws-s3-v3)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[league/flysystem-sftp-v3

SFTP filesystem adapter for Flysystem.

6129.6M91](/packages/league-flysystem-sftp-v3)[zgldh/qiniu-laravel-storage

Qiniu Resource (Cloud) Storage SDK for Laravel 5/6/7/8/9

530394.0k14](/packages/zgldh-qiniu-laravel-storage)[overtrue/flysystem-qiniu

Flysystem adapter for the Qiniu storage.

231891.2k58](/packages/overtrue-flysystem-qiniu)[yii2-starter-kit/yii2-file-kit

Yii2 file upload and storage kit

151216.8k6](/packages/yii2-starter-kit-yii2-file-kit)

PHPackages © 2026

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