PHPackages                             webmozart/key-value-store - 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. [Database &amp; ORM](/categories/database)
4. /
5. webmozart/key-value-store

ActiveLibrary[Database &amp; ORM](/categories/database)

webmozart/key-value-store
=========================

A key-value store API with implementations for different backends.

1.0.0(10y ago)124429.9k↑61.2%18[4 issues](https://github.com/webmozart/key-value-store/issues)[2 PRs](https://github.com/webmozart/key-value-store/pulls)11MITPHPPHP ^5.3.3|^7.0

Since Jan 12Pushed 4y ago10 watchersCompare

[ Source](https://github.com/webmozart/key-value-store)[ Packagist](https://packagist.org/packages/webmozart/key-value-store)[ RSS](/packages/webmozart-key-value-store/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (8)Dependencies (10)Versions (9)Used By (11)

Webmozart Key-Value-Store
=========================

[](#webmozart-key-value-store)

[![Build Status](https://camo.githubusercontent.com/6581ff9fab07fe0f823744745d7e776b5ce14d267b25787c01f3d7387ec4955c/68747470733a2f2f7472617669732d63692e6f72672f7765626d6f7a6172742f6b65792d76616c75652d73746f72652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/webmozart/key-value-store)[![Build status](https://camo.githubusercontent.com/dfa61c25abfdf8d59391e1dc8001d9ea2743839e50fb91bd78ef5600412ab988/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f6f776e34786f383536673561736763382f6272616e63682f6d61737465723f7376673d74727565)](https://ci.appveyor.com/project/webmozart/key-value-store/branch/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9f9ad66d28c868830789504f4a2a756342a27e4d6c563dcf49e7667ec8a96f19/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7765626d6f7a6172742f6b65792d76616c75652d73746f72652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/webmozart/key-value-store/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/a0493ec10339c1b94bdc4059e76fd37d33ccd8c29179a867c14fad750c6989bf/68747470733a2f2f706f7365722e707567782e6f72672f7765626d6f7a6172742f6b65792d76616c75652d73746f72652f762f737461626c652e737667)](https://packagist.org/packages/webmozart/key-value-store)[![Total Downloads](https://camo.githubusercontent.com/d32991c2bf2d51bb4b1cb618a60a7c2879a1bf9f1a328605d5ecccb70ad61029/68747470733a2f2f706f7365722e707567782e6f72672f7765626d6f7a6172742f6b65792d76616c75652d73746f72652f646f776e6c6f6164732e737667)](https://packagist.org/packages/webmozart/key-value-store)[![Dependency Status](https://camo.githubusercontent.com/9371b617524ce0fa02c5cf5b817c34e5b78ece3bc52ebce4d6f6d02c34df4c07/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f7765626d6f7a6172743a6b65792d76616c75652d73746f72652f312e302e302f62616467652e737667)](https://www.versioneye.com/php/webmozart:key-value-store/1.0.0)

Latest release: [1.0.0](https://packagist.org/packages/webmozart/key-value-store#1.0.0)

A key-value store API with implementations for different backends.

[API Documentation](https://webmozart.github.io/key-value-store/api)

All contained key-value stores implement the interface [`KeyValueStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.Api.KeyValueStore.html). The following stores are currently supported:

- [`ArrayStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.ArrayStore.html)
- [`DbalStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.DbalStore.html)
- [`JsonFileStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.JsonFileStore.html)
- [`MongoDbStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.MongoDbStore.html)
- [`NullStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.NullStore.html)
- [`PhpRedisStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.PhpRedisStore.html)
- [`PredisStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.PredisStore.html)
- [`RiakStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.RiakStore.html)

The interface [`CountableStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.Api.CountableStore.html) is supported by the following classes:

- [`ArrayStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.ArrayStore.html)
- [`JsonFileStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.JsonFileStore.html)
- [`NullStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.NullStore.html)
- [`CountableDecorator`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.Decorator.CountableDecorator.html)

The interface [`SortableStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.Api.SortableStore.html) is supported by the following classes:

- [`ArrayStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.ArrayStore.html)
- [`JsonFileStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.JsonFileStore.html)
- [`NullStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.NullStore.html)
- [`SortableDecorator`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.Decorator.SortableDecorator.html)

The decorator [`CachingDecorator`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.Decorator.CachingDecorator.html) exists for caching another store instance in a Doctrine cache.

FAQ
---

[](#faq)

**Why not use [Doctrine Cache](https://github.com/doctrine/cache)?**

Caching is **not** key-value storage. When you use a cache, you accept that keys may disappear for various reasons:

- Keys may expire.
- Keys may be overwritten when the cache is full.
- Keys may be lost after shutdowns.
- ...

In another word, caches are *volatile*. This is not a problem, since the cached data is usually stored safely somewhere else. The point of a cache is to provide high-performance access to frequently needed data.

Key-value stores, on the other hand, are *persistent*. When you write a key to a key-value store, you expect it to be there until you delete it. It would be a disaster if data would silently disappear from a key-value store (or any other kind of database).

Hence the two libraries fulfill two very different purposes, even if their interfaces and implementations are often similar.

The [`CachingDecorator`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.Decorator.CachingDecorator.html) actually uses a Doctrine Cache object to cache the data of a persistent [`KeyValueStore`](https://webmozart.github.io/key-value-store/api/latest/class-Webmozart.KeyValueStore.Api.KeyValueStore.html).

Authors
-------

[](#authors)

- [Bernhard Schussek](http://webmozarts.com) a.k.a. [@webmozart](https://twitter.com/webmozart)
- [The Community Contributors](https://github.com/webmozart/key-value-store/graphs/contributors)

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

[](#installation)

Use [Composer](https://getcomposer.org) to install the package:

```
$ composer require webmozart/key-value-store

```

Contribute
----------

[](#contribute)

Contributions to the package are always welcome!

- Report any bugs or issues you find on the [issue tracker](https://github.com/webmozart/key-value-store/issues).
- You can grab the source code at the package's [Git repository](https://github.com/webmozart/key-value-store).

Support
-------

[](#support)

If you are having problems, send a mail to  or shout out to [@webmozart](https://twitter.com/webmozart) on Twitter.

License
-------

[](#license)

All contents of this package are licensed under the [MIT license](LICENSE).

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity51

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 88.3% 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 ~82 days

Recently: every ~109 days

Total

8

Last Release

3660d ago

PHP version history (2 changes)1.0.0-betaPHP &gt;=5.3.3

1.0.0-beta7PHP ^5.3.3|^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/00803e109877ea9de0995e81c928871a595781bd6ea227092bfd7c6df5af58f0?d=identicon)[webmozart](/maintainers/webmozart)

---

Top Contributors

[![webmozart](https://avatars.githubusercontent.com/u/176399?v=4)](https://github.com/webmozart "webmozart (128 commits)")[![hacfi](https://avatars.githubusercontent.com/u/428841?v=4)](https://github.com/hacfi "hacfi (8 commits)")[![tgalopin](https://avatars.githubusercontent.com/u/1651494?v=4)](https://github.com/tgalopin "tgalopin (6 commits)")[![Miliooo](https://avatars.githubusercontent.com/u/3365006?v=4)](https://github.com/Miliooo "Miliooo (2 commits)")[![harikt](https://avatars.githubusercontent.com/u/120454?v=4)](https://github.com/harikt "harikt (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/webmozart-key-value-store/health.svg)

```
[![Health](https://phpackages.com/badges/webmozart-key-value-store/health.svg)](https://phpackages.com/packages/webmozart-key-value-store)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M777](/packages/sylius-sylius)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k30.0M2.9k](/packages/infection-infection)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2613.3M489](/packages/ssch-typo3-rector)[driftingly/rector-laravel

Rector upgrades rules for Laravel Framework

1.3k16.7M915](/packages/driftingly-rector-laravel)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136411.0k14](/packages/rector-rector-src)[phparkitect/phparkitect

Enforce architectural constraints in your PHP applications

9244.5M32](/packages/phparkitect-phparkitect)

PHPackages © 2026

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