PHPackages                             alex-unruh/dot-notation-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. alex-unruh/dot-notation-config

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

alex-unruh/dot-notation-config
==============================

An abstraction layer to get data from array or a file built on Dflydev\\DotAccessData\\Data

v1.0.0(4y ago)327MITPHPPHP &gt;=7.2

Since Mar 8Pushed 4y ago2 watchersCompare

[ Source](https://github.com/alex-unruh/dot-notation-config)[ Packagist](https://packagist.org/packages/alex-unruh/dot-notation-config)[ Docs](https://github.com/alex-unruh/dot-notation-config)[ RSS](/packages/alex-unruh-dot-notation-config/feed)WikiDiscussions master Synced 5d ago

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

Alex Unruh - Config
===================

[](#alex-unruh---config)

This library is based on the Laravel config concept. It values performance and was built on top of the library [Dflydev Dot Access data](https://github.com/dflydev/dflydev-dot-access-data).

The difference is that we can also access the data from a file instead of just an array in runtime execution.

### How to install:

[](#how-to-install)

```
composer require alex-unruh/dot-notation-config

```

### Usage with files:

[](#usage-with-files)

You can have as many configuration files as you want

```
// config/app.php

return [
  'app_name' => 'My App',

  'app_version' => '1.0.0',

  'connection_params' => [
    'host' => 'localhost',
    'dbname' => 'my_database',
    'user' => 'root',
    'password' => '',
    'port' => '3306'
  ]
];

// config/messages.php

return [
  'internal_error' => 'Internal server error',
  400 => 'Bad request'
];

// index.php

use AlexUnruh\Config;

Config::setDir('/config');

// Search data in /config/app.php file
echo Config::get('app.app_name'); // 'My App'
echo Config::get('app.connection_params.host'); // 'localhost'

// Search data in /config/messages.php file
echo Config::get('messages.400'); // 'Bad request'

print_r(Config::get('app')); // Returns all the array data placed in the app file.
```

### Usage with virtual data:

[](#usage-with-virtual-data)

```
// index.php

use AlexUnruh\Config;

$data = [
  'app_name' => 'My App',

  'app_version' => '1.0.0',

  'connection_params' => [
    'host' => 'localhost',
    'dbname' => 'my_database',
    'user' => 'root',
    'password' => '',
    'port' => '3306'
  ]
];

Config::setData('my_data', $data);

echo Config::get('my_data.app_name'); // 'My App'
echo Config::get('my_data.connection_params.host'); // 'localhost'

print_r(Config::get('my_data')); // Returns all the array data placed in the my_data array.
```

### Methods:

[](#methods)

The methods is the same presents in [Dflydev Dot Access data](https://github.com/dflydev/dflydev-dot-access-data). The difference is that the first argument in dot-notations is a file or a virtual config set alias defined on setDir or setData methods described above.

Methods: setDir, setData, get, set, has, remove and append.

```
// $my_config_dir = '/my-config-dir'
Config::setDir($my_config_dir);

// $my_array = ['app_name' => 'My App', 'app_version' => '1.0.0']
Config::setData($my_array);

// $my_array_search = 'app.app_name'
// $default_if_key_not_exists = 'My App'
Config::get($my_array_search, $default_if_key_not_exists); // 'My App'

// $my_array_item = 'app.name'
// $my_new_value = 'My New App Name'
Config::set($my_array_item, $my_new_value);

// $my_array_data = 'app'
// $the_key_im_looking_for = 'app_version'
Config::has($my_array_data, $the_key_im_looking_for); // true

// $my_array_item = 'app.app_licence'
// $value_to_append = 'MIT'
Config::append($my_array_item, $value_to_append);

// $my_array_item = 'app'
// $value_to_remove = 'app_licence'
Config::remove($my_array_item, $value_to_remove);
```

### Tricks:

[](#tricks)

As the library only has static methods, you can set the configuration files directory at any time or in any file called before manipulating the data through the class's methods.

Define the config dir in a file like a entry point and don't worry about him anymore...

```
// public/index.php

$config_path = $_SERVER['DOCUMENT_ROOT'] . $_ENV['BASE_PATH'] . '/config';
Config::setDir($config_path);

// controllers/services/MyService.php

echo Config::get('app.app_name'); // 'My App'
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

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

1529d ago

### Community

Maintainers

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

---

Top Contributors

[![alex-unruh](https://avatars.githubusercontent.com/u/33932795?v=4)](https://github.com/alex-unruh "alex-unruh (25 commits)")

---

Tags

configdotdataaccessnotation

### Embed Badge

![Health badge](/badges/alex-unruh-dot-notation-config/health.svg)

```
[![Health](https://phpackages.com/badges/alex-unruh-dot-notation-config/health.svg)](https://phpackages.com/packages/alex-unruh-dot-notation-config)
```

###  Alternatives

[dflydev/dot-access-data

Given a deep data structure, access data by dot notation.

718359.1M86](/packages/dflydev-dot-access-data)[league/config

Define configuration arrays with strict schemas and access values with dot notation

564302.2M24](/packages/league-config)[fakerphp/faker

Faker is a PHP library that generates fake data for you.

3.9k358.5M3.5k](/packages/fakerphp-faker)[symfony/options-resolver

Provides an improved replacement for the array\_replace PHP function

3.2k493.9M1.6k](/packages/symfony-options-resolver)[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[dflydev/dot-access-configuration

Given a deep data structure representing a configuration, access configuration by dot notation.

13414.5M4](/packages/dflydev-dot-access-configuration)

PHPackages © 2026

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