PHPackages                             mnapoli/blackbox - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. mnapoli/blackbox

ActiveLibrary[Testing &amp; Quality](/categories/testing)

mnapoli/blackbox
================

0.6.1(11y ago)1468[10 issues](https://github.com/mnapoli/BlackBox/issues)MITPHPPHP &gt;=5.4

Since Sep 23Pushed 8y ago3 watchersCompare

[ Source](https://github.com/mnapoli/BlackBox)[ Packagist](https://packagist.org/packages/mnapoli/blackbox)[ RSS](/packages/mnapoli-blackbox/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (8)Versions (15)Used By (0)

   currentMenu home  BlackBox
========

[](#blackbox)

BlackBox is a storage library that abstracts backends and data transformation behind simple interfaces.

[![Build Status](https://camo.githubusercontent.com/c56c90d593e88f942092d4998fe5c176528e3db310a51701e10938a1d964e210/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d6e61706f6c692f426c61636b426f782e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/mnapoli/BlackBox)[![Latest Version](https://camo.githubusercontent.com/628ebebda88cb49e68fe821a9ede72fcd3408ce040c944d0033b4ac800b89083/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6d6e61706f6c692f426c61636b426f782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mnapoli/BlackBox)

> Store data. "Where" and "how" can be decided later.

**Experimental: this project is still at the state of experimentation. Use with caution.**

Usage
-----

[](#usage)

The API is defined by interfaces and is extremely simple.

```
namespace BlackBox;

interface Storage extends Traversable
{
    public function get(string $id);
    public function set(string $id, $data) : void;
    public function remove(string $id) : void;
}

$storage->set('foo', 'Hello World!');

echo $storage->get('foo'); // Hello World!

foreach ($storage as $key => $item) {
    echo $key; // foo
    echo $item; // Hello World!
}
```

You can read all about those interfaces in the [Interfaces documentation](doc/interfaces.md).

Features
--------

[](#features)

BlackBox can store data in:

- files
- database (MySQL, PostgreSQL, SQLite, Oracle, …) using [Doctrine DBAL](http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/)
- PHP arrays (i.e. in memory)

Data can optionally be:

- stored in JSON
- stored in YAML
- encrypted with AES

Additionally a storage can be cached with another (e.g. cache a DB storage with a Redis or array storage).

Backends
--------

[](#backends)

Backends are classes that implement `Storage`:

- `FileStorage`
- `DirectoryStorage`
- `DatabaseTable`
- `ArrayStorage`

You can read all about backends in the [Backends documentation](doc/backends.md).

Transformers
------------

[](#transformers)

Transformers transform data before storage and after retrieval:

- `JsonEncoder`
- `YamlEncoder`
- `ObjectArrayMapper`
- `AesEncrypter`

You can read all about transformers in the [Transformers documentation](doc/transformers.md).

```
// Encode the data in JSON
$storage = new JsonEncoder(
    // Store data in files
    new DirectoryStorage('some/directory')
);

$storage->set('foo', [
    'name' => 'Lebowski',
]);
// will encode it in JSON
// then will store it into a file

$data = $storage->get('foo');
// will read from the file
// then will decode the JSON

echo $data['name']; // Lebowski
```

License
-------

[](#license)

BlackBox is released under the MIT license.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance6

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.4% 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 ~8 days

Recently: every ~1 days

Total

14

Last Release

4192d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/329a6111724074f5388e95dd41a03ccf3c43f4bfe1ecf27c94c9efc6f7823228?d=identicon)[mnapoli](/maintainers/mnapoli)

---

Top Contributors

[![mnapoli](https://avatars.githubusercontent.com/u/720328?v=4)](https://github.com/mnapoli "mnapoli (102 commits)")[![lombartec](https://avatars.githubusercontent.com/u/3073746?v=4)](https://github.com/lombartec "lombartec (3 commits)")[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (2 commits)")[![sagikazarmark](https://avatars.githubusercontent.com/u/1226384?v=4)](https://github.com/sagikazarmark "sagikazarmark (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mnapoli-blackbox/health.svg)

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

###  Alternatives

[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k251.7M11.6k](/packages/symfony-framework-bundle)[phpro/grumphp

A composer plugin that enables source code quality checks.

4.3k16.7M1.0k](/packages/phpro-grumphp)[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.2k28.9M2.4k](/packages/infection-infection)[phparkitect/phparkitect

Enforce architectural constraints in your PHP applications

9224.3M28](/packages/phparkitect-phparkitect)[mglaman/phpstan-drupal

Drupal extension and rules for PHPStan

20731.4M188](/packages/mglaman-phpstan-drupal)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15312.0M36](/packages/magento-magento2-functional-testing-framework)

PHPackages © 2026

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