PHPackages                             alex-kalanis/kw\_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. [Caching](/categories/caching)
4. /
5. alex-kalanis/kw\_storage

ActiveLibrary[Caching](/categories/caching)

alex-kalanis/kw\_storage
========================

Universal storage library for store data as key-value pairs

v6.0.0(1y ago)04.9k20BSD-3-ClausePHPPHP &gt;=7.4.0CI passing

Since Dec 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/alex-kalanis/kw_storage)[ Packagist](https://packagist.org/packages/alex-kalanis/kw_storage)[ RSS](/packages/alex-kalanis-kw-storage/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (5)Versions (18)Used By (20)

kw\_storage
===========

[](#kw_storage)

[![Build Status](https://github.com/alex-kalanis/kw_storage/actions/workflows/code_checks.yml/badge.svg)](https://github.com/alex-kalanis/kw_storage/actions/workflows/code_checks.yml/badge.svg)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/985b0b3c8cd6686c6d6ef7ecfaae754353ead67e80d1a86124f26c409d46ee34/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c65782d6b616c616e69732f6b775f73746f726167652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/alex-kalanis/kw_storage/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/bf149c1cc40ec888ef59bde48fe4efc8db967f496acb630743327c6fff82ad75/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6b616c616e69732f6b775f73746f726167652f762f737461626c652e7376673f763d31)](https://packagist.org/packages/alex-kalanis/kw_storage)[![Minimum PHP Version](https://camo.githubusercontent.com/0e9ac047546796cfdbe1423d1f4d91c8f37d2fbb11614a7900bb7686aaa5401f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e342d3838393242462e737667)](https://php.net/)[![Downloads](https://camo.githubusercontent.com/27da34d4af990437959d09bff5d0b5410f6764d5418fb3720c546dc85dbff4a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c65782d6b616c616e69732f6b775f73746f726167652e7376673f7631)](https://packagist.org/packages/alex-kalanis/kw_storage)[![License](https://camo.githubusercontent.com/2ccf1ebdd4937720a8c3c086448462fb4ba111e209c71869fb258bc74f4296f3/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6b616c616e69732f6b775f73746f726167652f6c6963656e73652e7376673f763d31)](https://packagist.org/packages/alex-kalanis/kw_storage)[![Code Coverage](https://camo.githubusercontent.com/7244fb9dfcfef9ed5c10ff43cbe87dd6fe4f858e561e73930148ad18fe3787a6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c65782d6b616c616e69732f6b775f73746f726167652f6261646765732f636f7665726167652e706e673f623d6d617374657226763d31)](https://scrutinizer-ci.com/g/alex-kalanis/kw_storage/?branch=master)

Simple system for accessing key-value storages. Original is part of UploadPerPartes, where it's necessary for store states of upload. To data it behaves like simple key-value storage. Which can derive to real flat storages like memory or redis or tree-like structures like your normal filesystem. No streams here.

The main thing about this package are the interfaces. Especially `IStorage` which represents all supported operations over storages and shall be used on upper layers as the only necessary dependency.

It is also the correct way to get it via `Access\Factory` class which select the best possible storage in accordance with passed params from your configuration. That can be put inside your DI.

This package also contains translations interface. So you can customize error messages for your devs and users.

PHP Installation
----------------

[](#php-installation)

```
composer.phar require alex-kalanis/kw_storage
```

(Refer to [Composer Documentation](https://github.com/composer/composer/blob/master/doc/00-intro.md#introduction) if you are not familiar with composer)

Changes
-------

[](#changes)

- 6.0 - Use DateTime interfaces, tests for 8.4 and own namespaces
- 5.0 - Streams are on different level, not here
- 4.0 - Redefine factories and some key classes
- 3.0 - Redefine interfaces for targets
- 2.0 - Redefine Key-Value storing data
    - Remove formats and cache support (that should not be a problem of storage)
    - Added stream variant support
    - Added interface for catching content with sub-content (so directories) on storage-level
- 1.0 - Initial version, with basics and cache support

PHP Usage
---------

[](#php-usage)

It partially depends on real storage. Can be local filesystem, can be remote service too. But the interfaces in this package make them all equal in terms of usage. So...

1.) Use your autoloader (if not already done via Composer autoloader)

2.) Add some external packages with connection to the local or remote services. Can be Redis or AWS or something else. Or nothing if it is only local FS.

3.) Connect either `kalanis\kw_storage\Interfaces\IStorage`, `kalanis\kw_storage\Storage`or `kalanis\kw_storage\Helper` into your app. That usually happens in DI. Extend it for setting your case, especially if you use tree with dirs.

4.) Extend your libraries by interfaces inside the package. Mainly `kalanis\kw_storage\Interfaces\IStorage` which represents that available actions or `kalanis\kw_storage\Storage` which packs it like facade.

5.) Just use inside your app.

```
// DI-like
return function (array $params): \kalanis\kw_storage\Interfaces\IStorage {
    $storage = (new \kalanis\kw_storage\Storage(
        new \kalanis\kw_storage\Storage\Factory()) // here can be changed to select different storage
    );
    $storage->init($params);
    return $storage->getStorage();
}
```

```
// Classes
class Counter
{
    protected const string MY_KEY = 'my_key';

    public function __construct(
        // ...
        protected readonly \kalanis\kw_storage\Interfaces\IStorage $storage,
        // ...
    ) {
    }

    public function __destruct()
    {
        $this->storage->remove(static::MY_KEY);
    }

    public function clear(): bool
    {
        return $this->storage->write(static::MY_KEY, '0');
    }

    public function increment(): bool
    {
        return $this->storage->increment(static::MY_KEY);
    }

    public function get(): int
    {
        try {
            return intval($this->storage->read(static::MY_KEY));
        } catch (\kalanis\kw_storage\StorageException $ex) {
            return 0;
        }
    }
}
```

#### Notes

[](#notes)

Listing output contains storage separators. Asked root record is empty, the rest has that separator at least on the beginning. It depends on storage and class if the listing came with complete tree with sub-entries or just first level.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance49

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity62

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

Recently: every ~172 days

Total

17

Last Release

371d ago

Major Versions

v1.0.4 → v2.0.02022-08-17

v2.0.0 → v3.0.02022-09-01

v3.4.1 → v4.0.02023-07-30

v4.0.1 → v5.0.02024-03-29

v5.0.0 → v6.0.02025-05-04

PHP version history (2 changes)v1.0.0PHP &gt;=7.2.0

v5.0.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/499b0a541b787cdb31412f578c7b94c9790bcbee7de12c65b6101c6ce45ef6f0?d=identicon)[alex-kalanis](/maintainers/alex-kalanis)

---

Top Contributors

[![alex-kalanis](https://avatars.githubusercontent.com/u/59184183?v=4)](https://github.com/alex-kalanis "alex-kalanis (36 commits)")

---

Tags

cachestoragevolume

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/alex-kalanis-kw-storage/health.svg)

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

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k727.3M2.1k](/packages/psr-simple-cache)[psr/cache

Common interface for caching libraries

5.2k686.9M1.3k](/packages/psr-cache)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[beste/in-memory-cache

A PSR-6 In-Memory cache that can be used as a fallback implementation and/or in tests.

2512.2M6](/packages/beste-in-memory-cache)[alekseykorzun/memcached-wrapper-php

Optimized PHP 5 wrapper for Memcached extension that supports dog-piling, igbinary and local storage

2984.6k1](/packages/alekseykorzun-memcached-wrapper-php)

PHPackages © 2026

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