PHPackages                             namshi/preconfig - 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. namshi/preconfig

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

namshi/preconfig
================

This is a port of Namshi/reconfig from JS to PHP

0.1.0(11y ago)21391MITPHP

Since Sep 2Pushed 11y ago29 watchersCompare

[ Source](https://github.com/namshi/preconfig)[ Packagist](https://packagist.org/packages/namshi/preconfig)[ RSS](/packages/namshi-preconfig/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

NAMSHI | PreConfig
==================

[](#namshi--preconfig)

[![Build Status](https://camo.githubusercontent.com/3f0cb7146cadeee0c5defdd97e26bc3f3a6911dce93371488262ace19dcea33c/68747470733a2f2f6170692e7472617669732d63692e636f6d2f6e616d7368692f707265636f6e6669672e7376673f746f6b656e3d67704466735a36704d733856687865797571314b266272616e63683d6d6173746572)](https://magnum.travis-ci.com/namshi/preconfig)

In PHP handling configs even as array is not easy, when you need to reference related configs or replace strings in configs it is not straightforward. This library will help you define configurations in clean, decoupled and smart way resulting in easy retrieval of configuration values. How? read on.

This library is a PHP port of [Namshi/Reconfig](https://github.com/namshi/reconfig) javascript library.

Prerequisites
-------------

[](#prerequisites)

This library needs PHP 5.4+.

It has been tested using PHP5.4 to PHP5.6 and HHVM.

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

[](#installation)

You can install the library directly with composer:

```
"namshi/preconfig": "0.1.0"

```

Usage
-----

[](#usage)

A simple example is given below:

### Access a multi-dimensional array

[](#access-a-multi-dimensional-array)

```
namespace Your\Namespace

use Namshi\PreConfig\PreConfig;

public function foo()
{
    $argument = [
                'key1' => [
                    'key2' => '{{ key1.key3 }}',
                    'key3' => [
                        'key4' => 'value4',
                        'key5' => 'value5'
                    ]
                ]
            ];

    $preConfig = new PreConfig($argument);

    $key3 = $preConfig->get('key1.key3');
}
```

You can see more examples in the [example](src/Namshi/PreConfig/Example/example.php) file.

Tests
-----

[](#tests)

We used [phpspec](http://www.phpspec.net) to write tests. They are more like specs than just tests. You will need [composer](https://getcomposer.org) to get the dependencies, to run tests locally, execute the following commands:

```
 ᐅ composer install --dev --prefer-source
 ᐅ php vendor/bin/phpspec run
```

Feedback
--------

[](#feedback)

Add an issue, open a PR, drop us an email! We would love to hear from you!

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

4273d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/170554?v=4)[Geshan Manandhar](/maintainers/geshan)[@geshan](https://github.com/geshan)

---

Top Contributors

[![AyhamAlzoubi](https://avatars.githubusercontent.com/u/1628272?v=4)](https://github.com/AyhamAlzoubi "AyhamAlzoubi (11 commits)")

### Embed Badge

![Health badge](/badges/namshi-preconfig/health.svg)

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

###  Alternatives

[makeabledk/laravel-factory-enhanced

180118.6k4](/packages/makeabledk-laravel-factory-enhanced)[lukeraymonddowning/self-healing-urls

16715.9k](/packages/lukeraymonddowning-self-healing-urls)[yii2mod/yii2-sweet-alert

Alert widget based on SweetAlert extension {@link http://tristanedwards.me/sweetalert)

43154.0k2](/packages/yii2mod-yii2-sweet-alert)[heureka/inflection

Czech inflection library

6163.9k](/packages/heureka-inflection)[ptachoire/php-dmtx

Datamatrix r/w based on libdmtx &lt;http://www.libdmtx.org/&gt;

1868.3k](/packages/ptachoire-php-dmtx)[cybercog/yii2-google-analytics

Google Analytics Widget for the Yii2 framework

1677.1k2](/packages/cybercog-yii2-google-analytics)

PHPackages © 2026

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