PHPackages                             phpnomad/config - 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. phpnomad/config

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

phpnomad/config
===============

1.0.0(1y ago)0117[1 PRs](https://github.com/phpnomad/config/pulls)3MITPHPCI passing

Since Oct 30Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/phpnomad/config)[ Packagist](https://packagist.org/packages/phpnomad/config)[ Docs](https://github.com/phpnomad/core)[ RSS](/packages/phpnomad-config/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (6)Used By (3)

phpnomad/config
===============

[](#phpnomadconfig)

[![Latest Version](https://camo.githubusercontent.com/152f5b88ca2c7219278d13d48ce644eacd45bd9229f3e1db47a88d1cfe1ce5c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068706e6f6d61642f636f6e6669672e737667)](https://packagist.org/packages/phpnomad/config)[![Total Downloads](https://camo.githubusercontent.com/d3d141e94f2035d168cf2961494365c90203cd89442b7e11422c7d8862396e10/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068706e6f6d61642f636f6e6669672e737667)](https://packagist.org/packages/phpnomad/config)[![PHP Version](https://camo.githubusercontent.com/0e66f587baba27ed62a6cf5792cf15378b7cb7a4f2196aa69371a690afb78127/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068706e6f6d61642f636f6e6669672e737667)](https://packagist.org/packages/phpnomad/config)[![License](https://camo.githubusercontent.com/1733c9bd5b7d9f2ec082df87c644c16a2b421f37974acf8ab9202bb59f612f93/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068706e6f6d61642f636f6e6669672e737667)](https://packagist.org/packages/phpnomad/config)

`phpnomad/config` is a strategy-based configuration layer for PHP applications. It splits configuration into two separate concerns, one for how values are stored and looked up and another for how files are read from disk. Both live behind interfaces, so you can change either one without touching the code that consumes configuration values.

The package defines `ConfigStrategy` for storage and lookup, `ConfigFileLoaderStrategy` for file loading, and a `ConfigService` that ties them together. Keys are accessed with dot-notation, so nested structures like `app.mailer.host` work out of a single `get` call. The base package has no runtime dependencies. Concrete file-loading backends live in separate packages.

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

[](#installation)

```
composer require phpnomad/config
```

Quick Start
-----------

[](#quick-start)

Once you have a `ConfigStrategy` implementation, register a namespace of config data and read values back with dot-notation keys.

```
use PHPNomad\Config\Interfaces\ConfigStrategy;

/** @var ConfigStrategy $config */
$config->register('app', [
    'debug'  => false,
    'locale' => 'en_US',
    'mailer' => [
        'host' => 'smtp.example.com',
        'port' => 587,
    ],
]);

$config->get('app.debug');              // false
$config->get('app.mailer.host');        // 'smtp.example.com'
$config->get('app.mailer.timeout', 30); // 30 (default fallback)
$config->has('app.mailer.host');        // true
```

`ConfigStrategy` is an interface. Pair it with a concrete implementation like [`phpnomad/json-config-integration`](https://packagist.org/packages/phpnomad/json-config-integration) for JSON files, or [`phpnomad/array-json-config`](https://packagist.org/packages/phpnomad/array-json-config) for a basic arrays and JSON setup. You can also implement `ConfigStrategy` directly against any storage backend you need.

Key Concepts
------------

[](#key-concepts)

- `ConfigStrategy` registers a top-level key with an array of config data and reads single values with dot-notation lookups. `get()` accepts a default for missing keys. `has()` reports whether a key resolves to a value.
- `ConfigFileLoaderStrategy` turns a file path into an array of configuration data. This keeps file-format decisions (JSON, PHP, YAML, or anything else) separate from how the data is stored.
- `ConfigService` takes a `ConfigStrategy` and a `ConfigFileLoaderStrategy` in its constructor. Call `registerConfig($key, $path)` to load a file through the loader and register its contents under a namespace in the strategy.
- `ConfigException` is raised when loading or registering configuration fails, so consumers have a single exception type to catch around config setup.

Documentation
-------------

[](#documentation)

Full documentation, including the interface contracts and guidance on writing your own strategies, lives at [phpnomad.com](https://phpnomad.com).

License
-------

[](#license)

MIT. See [LICENSE.txt](LICENSE.txt).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance64

Regular maintenance activity

Popularity10

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

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

561d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e6206223bd6f2a57b8ac80605b1b5c3521faaec18ad3f20f25fb728a9a13784?d=identicon)[tstandiford](/maintainers/tstandiford)

---

Top Contributors

[![alexstandiford](https://avatars.githubusercontent.com/u/8210827?v=4)](https://github.com/alexstandiford "alexstandiford (14 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

configconfigurationframeworkphpphpnomadplatform-agnostic

### Embed Badge

![Health badge](/badges/phpnomad-config/health.svg)

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

###  Alternatives

[spatie/laravel-robots-middleware

Add an `all` or `none` robots header to your requests via a middleware in Laravel

3372.2M5](/packages/spatie-laravel-robots-middleware)[laminas/laminas-config-aggregator

Lightweight library for collecting and merging configuration from different sources

404.4M140](/packages/laminas-laminas-config-aggregator)

PHPackages © 2026

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