PHPackages                             rayson-x/fast-dfs - 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. rayson-x/fast-dfs

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

rayson-x/fast-dfs
=================

PHP FastDFS Client

310PHP

Since Nov 2Pushed 4y ago1 watchersCompare

[ Source](https://github.com/rayson-x/FastDfsClient)[ Packagist](https://packagist.org/packages/rayson-x/fast-dfs)[ RSS](/packages/rayson-x-fast-dfs/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

fastdfs-client-php
==================

[](#fastdfs-client-php)

PHP实现的FastDFS客户端

### 安装

[](#安装)

```
composer require rayson-x/fast-dfs

```

### 介绍

[](#介绍)

参考[java版](https://github.com/tobato/FastDFS_Client)实现

单元测试使用的服务端版本为FastDFS\_V6.07

PHP版本要求8.0以上

### 开始使用

[](#开始使用)

#### 连接到追踪服务器

[](#连接到追踪服务器)

```
use Ant\FastDFS\TrackerClient;

include __DIR__ . "/vendor/autoload.php";

// 初始化追踪服务器客户端
$trackerClient = new TrackerClient(['localhost:22122']);
```

#### 从追踪服务器获取存储服务器信息

[](#从追踪服务器获取存储服务器信息)

```
// 随机获取存储服务客户端
$storageClient = $trackerClient->getStorageClient();
// 根据组名获取
$storageClient = $trackerClient->getStorageClientWithGroup('group1');
// 获取根据断点续传的文件获取可用的存储服务
$storageClient = $trackerClient->getAppendClient('group1', 'M00/00/5B/wKgM_mFMPeWEEzrOAAAAALdUwZ4945.txt');
```

#### 上传一个文件

[](#上传一个文件)

```
// 根据文件路径上传
$storePath = $storageClient->uploadFile('filepath');
// 上传字符串
$storePath = $storageClient->uploadBuffer('foobar', 'txt');

// group1/M00/00/52/wKgM_mFFkIiIX2FYAAAAPDbjiZ4AAAAcQCptLQAAABU459.txt
$urlPath = "{$storePath->group}/{$storePath->path}";
```

#### 创建一个断点续传的文件

[](#创建一个断点续传的文件)

```
// 根据文件路径上传
$storePath = $storageClient->uploadFile('filepath', true);
// 上传字符串
$storePath = $storageClient->uploadBuffer('foobar', 'txt', true);
```

#### 在追加内容到支持断点续传文件上

[](#在追加内容到支持断点续传文件上)

```
// 追加一个文件
$storageClient->appendFile($storePath->path, 'filepath');
// 追加字符串
$storageClient->appendFile($storePath->path, 'foobar');
```

### 参考文档

[](#参考文档)

[FastDFS的架构原理参考](https://github.com/tobato/FastDFS_Client/wiki). [协议参考](http://weakyon.com/2014/09/01/analysis-of-source-code-for-fastdfs.html)

### TODO

[](#todo)

- 分部署部署时,多台tracker服务器处理
- 实现一个可自定义的连接器
- 支持ReactPhp,Swoole,默认Socket
- 常驻进程模式支持连接池

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/755ad6fc19e3debf94bfe59b23b134b06d92c16a989411f0f38553b18c7a107f?d=identicon)[rayson](/maintainers/rayson)

---

Top Contributors

[![rayson-x](https://avatars.githubusercontent.com/u/17398068?v=4)](https://github.com/rayson-x "rayson-x (57 commits)")

### Embed Badge

![Health badge](/badges/rayson-x-fast-dfs/health.svg)

```
[![Health](https://phpackages.com/badges/rayson-x-fast-dfs/health.svg)](https://phpackages.com/packages/rayson-x-fast-dfs)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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