PHPackages                             ailixter/gears-dictionary - 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. ailixter/gears-dictionary

ActiveLibrary

ailixter/gears-dictionary
=========================

The project, which Gears Dictionary.

0.1.1(6y ago)00MITPHPPHP ^7

Since Nov 19Pushed 6y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

gears-dictionary
================

[](#gears-dictionary)

The project, which Gears Dictionary

Flat Dictionary
---------------

[](#flat-dictionary)

### use Ailixter\\Gears\\Dictionary\\ReadonlyFlat;

[](#use-ailixtergearsdictionaryreadonlyflat)

```
$readonly = new ReadonlyFlat(['x' => 123]);

if ($readonly->has('x')) {
    echo $readonly->get('x'); // 123
}
echo $readonly->get('y'); // null
echo $readonly->get('y', 'notset'); // 'notset'
echo $readonly['y']; // null
echo isset($readonly['x']); // true
echo isset($readonly['y']); // false
unset($readonly['x']); // AccessException
```

### use Ailixter\\Gears\\Dictionary\\Flat;

[](#use-ailixtergearsdictionaryflat)

```
$writable = new Flat($readonly->all());

$writable->set('x', 456);
$array = $writable->set('y', 789)->remove('x')->all(); // ['y' => 789]
echo $writable->has('y'); // true
```

Structured Dictionary
---------------------

[](#structured-dictionary)

### use Ailixter\\Gears\\Dictionary\\ReadonlyStruct;

[](#use-ailixtergearsdictionaryreadonlystruct)

```
$readonly = new ReadonlyStruct([
    'x' => [123, 456],
    'y' => [
        'z' => 789
    ]
]);

if ($readonly->has('x')) {
    echo $readonly->get('x'); // [123, 456]
}
echo $readonly->get('x/0'); // 123
echo $readonly['x/1']; // 456
echo isset($readonly['y/z']); // true
echo isset($readonly['y/z/0']); // false
unset($readonly['x/0']); // AccessException
```

### use Ailixter\\Gears\\Dictionary\\Struct;

[](#use-ailixtergearsdictionarystruct)

```
$writable = new Struct($readonly->all());

$writable->set('x', 456);
$writable->has('x/0'); // false
```

```
$writable->add('x', 456);
$writable->has('x/0'); // true
$writable->get('x'); // [456]
```

Interfaces
----------

[](#interfaces)

### use Ailixter\\Gears\\Dictionary\\ReadonlyDictionaryInterface;

[](#use-ailixtergearsdictionaryreadonlydictionaryinterface)

```
function testReadonly (ReadonlyDictionaryInterface $readonly) {
    return $readonly->get('param');
}

testReadonly(new ReadonlyFlat($_POST)) === testReadonly(new Struct($_POST)); // true
```

### use Ailixter\\Gears\\Dictionary\\DictionaryInterface;

[](#use-ailixtergearsdictionarydictionaryinterface)

```
function testWritable (DictionaryInterface $writable, $key) {
    return $writable->set($key, 123)->get($key);
}

testWritable(new Flat($_POST), 'param') === testWritable(new Struct($_POST), 'data/0'); // true
```

DictionaryExtraInterface
------------------------

[](#dictionaryextrainterface)

### use extracting:

[](#use-extracting)

```
$writable->has('x'); // true
echo $writable->extract('x'); // [456]
$writable->has('x'); // false
```

### use references:

[](#use-references)

```
$writable = new Flat;
$var =& $writable->ref('x');
$writable->set('x', 123);
echo $var; // 123
```

```
$writable = new Struct;
$var = 123;
$writable->setref('x/0', $var);
$var = 456;
echo $writable->get['x']; // [456]
```

```
(new Struct)->refer($_GET)->set('p/route', 'chapter/1');
echo $_GET['p']; // ['route' => 'chapter/1']
```

Howtos
------

[](#howtos)

### Struct: use custom path separator

[](#struct-use-custom-path-separator)

```
echo new Struct(['x' => [123, 456])->setPathSeparator('.')->get('x.0'); // 123
```

### Struct: export data

[](#struct-export-data)

```
function export($dbRecord, $map) {
    $jsonData = new Struct;
    foreach ($map as $dst => $src) {
        $jsonData[$dst] = $dbRecord[$src];
    }
    return $jsonData;
}

$jsonData = export(new Struct($dbRecord), [
    'record_id'       => 'id',
    'contacts/email'  => 'email',
    'contacts/phone'  => 'phone',
    'logo_url'        => 'images/url/0'
]);
echo json_encode($jsonData->all());
```

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

Total

2

Last Release

2458d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d75f48a062262cb8bb0e9b241ec74bc7363ed041c9eba8fd40d36e7fd3e52ca5?d=identicon)[ailixter](/maintainers/ailixter)

---

Top Contributors

[![ailixter](https://avatars.githubusercontent.com/u/8529462?v=4)](https://github.com/ailixter "ailixter (9 commits)")

---

Tags

arraysdatadictionariesdictionaryphpstructutilities

### Embed Badge

![Health badge](/badges/ailixter-gears-dictionary/health.svg)

```
[![Health](https://phpackages.com/badges/ailixter-gears-dictionary/health.svg)](https://phpackages.com/packages/ailixter-gears-dictionary)
```

PHPackages © 2026

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