PHPackages                             rstgroup/php-consul-kv-array-getter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rstgroup/php-consul-kv-array-getter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rstgroup/php-consul-kv-array-getter
===================================

This library allows you to receive the consul's KV Store's keys as a structured array.

1.0(8y ago)0481MITPHPPHP &gt;= 5.6

Since Jul 26Pushed 8y ago13 watchersCompare

[ Source](https://github.com/rstgroup/php-consul-kv-array-getter)[ Packagist](https://packagist.org/packages/rstgroup/php-consul-kv-array-getter)[ RSS](/packages/rstgroup-php-consul-kv-array-getter/feed)WikiDiscussions master Synced 2mo ago

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

Consul KV Array Getter
======================

[](#consul-kv-array-getter)

[![Build Status](https://camo.githubusercontent.com/c71663af8ad4b7c0e8f5e8cd6478e3b6bd12ec261aff47fdba7677b2d3fc9a40/68747470733a2f2f7472617669732d63692e6f72672f72737467726f75702f7068702d636f6e73756c2d6b762d61727261792d6765747465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rstgroup/php-consul-kv-array-getter)

What does this library do?
--------------------------

[](#what-does-this-library-do)

The library allows you to retrieve whole tree of properties from Consul's KV store. Retrieved data is grouped into nested arrays.

How to install it?
------------------

[](#how-to-install-it)

Require the package by Composer:

```
composer require rstgroup/php-consul-kv-array-getter
```

How to use the library?
-----------------------

[](#how-to-use-the-library)

All you need is instance of `SensioLabs\Consul\Services\KVInterface` and pass it to the `RstGroup\PhpConsulKVArrayGetter\Consul\ConsulArrayGetter` constructor:

```
use SensioLabs\Consul\ServiceFactory;
use SensioLabs\Consul\Services\KVInterface;
use RstGroup\PhpConsulKVArrayGetter\Consul\ConsulArrayGetter;

// your consul options:
$consulParams = [
    'base_uri' => 'http://consul-domain:8500'
];

// prepare service that talks to Consul KV
$consulServicesFactory = new ServiceFactory($consulParams);
$kvService = $consulServicesFactory->get(KVInterface::class);

// create getter instance
$consulArrayGetter = new ConsulArrayGetter(
    $kvService
);

// get the keys as structure
$result = $consulArrayGetter->getByPrefix('prefix');
```

How keys are mapped to return structure?
----------------------------------------

[](#how-keys-are-mapped-to-return-structure)

Let's assume we have list of keys present in KV Store:

```
application/db/host      => 'some host'
application/cache/prefix => 'abcd.prefix'
application/name         => 'app'

```

If we fetch config with prefix `'application'` we will receive:

```
$consulArrayGetter->getByPrefix('application') == [
    'application' => [
        'db' => [ 'host' => 'some host' ],
        'cache' => [ 'prefix' => 'abcd.prefix' ],
        'name' => 'app'
    ]
]
```

If you add slash at the end, the result array will be created relative to `application` key:

```
$consulArrayGetter->getByPrefix('application/') == [
    'db' => [ 'host' => 'some host' ],
    'cache' => [ 'prefix' => 'abcd.prefix' ],
    'name' => 'app'
]
```

Adding another key part after slash will return only those keys that match given prefix:

```
$consulArrayGetter->getByPrefix('application/db') == [
    'db' => [ 'host' => 'some host' ]
]
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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

Unknown

Total

1

Last Release

3217d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ffa5d2fe34b04844f854a4fa7ce073c69a500fe6352d69461756abf1b23599d?d=identicon)[rstgroup](/maintainers/rstgroup)

---

Top Contributors

[![artospaj](https://avatars.githubusercontent.com/u/11021356?v=4)](https://github.com/artospaj "artospaj (3 commits)")[![snapshotpl](https://avatars.githubusercontent.com/u/312655?v=4)](https://github.com/snapshotpl "snapshotpl (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rstgroup-php-consul-kv-array-getter/health.svg)

```
[![Health](https://phpackages.com/badges/rstgroup-php-consul-kv-array-getter/health.svg)](https://phpackages.com/packages/rstgroup-php-consul-kv-array-getter)
```

PHPackages © 2026

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