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

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

fastd/storage
=============

FastD php simple framework Storage Component

v2.0.1(9y ago)12.1k12MITPHPPHP &gt;=7.0

Since Jun 21Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (14)Used By (2)

Storage
=======

[](#storage)

[![Building](https://camo.githubusercontent.com/f674eee3c534549942e514cb430043dfc1aa7dd109cdae0eb13a9edc51a85362/68747470733a2f2f6170692e7472617669732d63692e6f72672f4a616e4875616e672f73746f726167652e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/f674eee3c534549942e514cb430043dfc1aa7dd109cdae0eb13a9edc51a85362/68747470733a2f2f6170692e7472617669732d63692e6f72672f4a616e4875616e672f73746f726167652e7376673f6272616e63683d6d6173746572)[![Latest Stable Version](https://camo.githubusercontent.com/229315e143207bc66e29c3fba2513e16eef798b721f635e081c8d476fea75572/68747470733a2f2f706f7365722e707567782e6f72672f66617374642f73746f726167652f762f737461626c65)](https://packagist.org/packages/fastd/storage) [![Total Downloads](https://camo.githubusercontent.com/b033f0cf6595ee2627fe49a38a8388ca64f5bd5e0d61d778b8f6f76492d1d720/68747470733a2f2f706f7365722e707567782e6f72672f66617374642f73746f726167652f646f776e6c6f616473)](https://packagist.org/packages/fastd/storage) [![Latest Unstable Version](https://camo.githubusercontent.com/feed261ea9b132504b8997c0791f9f5e2a626487cb00039011a8dd1a3d004655/68747470733a2f2f706f7365722e707567782e6f72672f66617374642f73746f726167652f762f756e737461626c65)](https://packagist.org/packages/fastd/storage) [![License](https://camo.githubusercontent.com/087ed26e58ba79dd852ff1de8fb651fa843b5847bbb480b18572902624544b56/68747470733a2f2f706f7365722e707567782e6f72672f66617374642f73746f726167652f6c6963656e7365)](https://packagist.org/packages/fastd/storage)

简单的 PHP 存储类组件，支持原生 Memcached, Redis, SSDB 等操作。

要求
--

[](#要求)

- PHP 7+

Composer
--------

[](#composer)

```
{
    "fastd/storage": "2.0.x-dev"
}
```

扩展
--

[](#扩展)

- Redis
- Memcached
- SSDB

使用
--

[](#使用)

都是简单的封装，实现统一一套 API，统一入口和基础 key/value 存储操作

### 文件缓存

[](#文件缓存)

文件缓存此处仅使用最简单的 `\SplFileObject` 进行扩展，因为文件缓存样式以及支持的存储类型不是太过于丰富，所以此处仅作为最简单的 key/value 方式进行存储。

```
$file = new File(__DIR__ . '/test.log');

$file->set('janhuang');

$content = $file->get();
```

通过 `set` 方法存储内容， 通过 `get` 方法获取存储的内容，具体操作请看 `\SplFileObject`，文件存储对象继承于 `SplFileObject`

### Redis

[](#redis)

```
use FastD\Storage\Redis\Redis;

$redis = new Redis([
    'host' => '',
    'port' => '',
    'auth' => ''
]);

$redis->set($name, $value, $ttl = 0);

$redis->get($name);
```

获取 Redis 与原生对象，保持使用上的灵活。

```
use FastD\Storage\Redis\Redis;

$redis = Redis::connect([
    'host' => '',
    'port' => '',
    'auth' => ''
]);

// 原生 redis 操作

$redis->mset($name, $value);
```

`Redis::connection(array $config): \Redis` 返回一个原生操作的扩展对象，可以然你按照原生的方式操作。

### Memcached

[](#memcached)

```
use FastD\Storage\Memcached\Memcached;

$memcached = new Memcached([
    'host' => '',
    'port' => ''
]);

$memcached->set('age', '18');
```

原生操作

```
use FastD\Storage\Memcached\Memcached;

$memcached = Memcached::connect([
    'host' => '',
    'port' => ''
]);
```

### SSDB

[](#ssdb)

```
use FastD\Storage\Ssdb\Ssdb;

$ssdb = new Ssdb([
    'host' => '',
    'port' => ''
]);
```

原生操作

```
use FastD\Storage\Ssdb\Ssdb;

$ssdb = Ssdb::connect([
    'host' => '',
    'port' => ''
]);
```

### 友情提示

[](#友情提示)

所有缓存操作都实现 `FastD\Storage\CacheInterface` 接口，所以缓存操作保持一致，**注意各个存储得兼容方式。** 均使用 `new` 进行实例化。

而原生操作均使用 `FastD\Storage\StorageInterface::connect(array $config)` 静态方法进行获取，文件存储较为特殊，只有 `open` 方法。

**友谊得小船不能说翻就翻**

Testing
-------

[](#testing)

```
phpunit
```

License MIT
-----------

[](#license-mit)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

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

Total

11

Last Release

3407d ago

Major Versions

v0.1.1 → v2.0.0-beta12016-05-11

2.1.x-dev → 3.0.x-dev2017-01-19

PHP version history (3 changes)v0.1.0PHP &gt;=5.4

v2.0.0-beta1PHP &gt;=7.0

3.0.x-devPHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/94c2bc821caf23977e1c3deea85e3cbc9a73a632e1afaf778638f7fe9da1c42b?d=identicon)[JanHuang](/maintainers/JanHuang)

---

Top Contributors

[![JanHuang](https://avatars.githubusercontent.com/u/7090871?v=4)](https://github.com/JanHuang "JanHuang (37 commits)")

---

Tags

storageFastD

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[league/flysystem

File storage abstraction for PHP

13.6k639.1M2.2k](/packages/league-flysystem)[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

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

Google Cloud Client Library

1.2k16.2M53](/packages/google-cloud)[qiniu/php-sdk

Qiniu Resource (Cloud) Storage SDK for PHP

8483.0M240](/packages/qiniu-php-sdk)[sylius/resource-bundle

Resource component for Sylius.

23410.2M173](/packages/sylius-resource-bundle)[microsoft/azure-storage-blob

This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs.

5516.0M60](/packages/microsoft-azure-storage-blob)

PHPackages © 2026

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