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

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

geeksareforlife/config
======================

A simple configuration library

0.1.1(7y ago)017MITPHPPHP ^5.3.3 || ^7.0

Since Sep 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/geeksareforlife/config)[ Packagist](https://packagist.org/packages/geeksareforlife/config)[ Docs](https://github.com/geeksareforlife/config)[ RSS](/packages/geeksareforlife-config/feed)WikiDiscussions main Synced 4w ago

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

Config
======

[](#config)

A simple configuration library

This library stores config in two files - a normal config file and a defaults file.

When retrieving a value from the config, the normal config is checked first and if nothing is found the value from the defaults file is used.

Getting Started
---------------

[](#getting-started)

Install [Composer](https://getcomposer.org/download/) and run the following command to get the latest version:

```
composer require "geeksareforlife/config:^0.1"

```

Basic Usage
-----------

[](#basic-usage)

First, create a config object and load the files (**Files will be created if they don't exist**):

```
$config = new Config();
$config->load('/path/to/config.json', '/path/to/defaultConfig.json');

```

Then you can get or set values into the config object. Keys are dot-seperated.

```
$value = $config->getValue('key.name');
$config->setValue('key.name', $value);

```

When you have finished, you need to call the save function to commit the config to disk.

```
$config->save();

```

More Details
------------

[](#more-details)

Values can be stored in two config files. Each file is a single JSON object.

Keys are in dot-notation, and an optional "module" can be used for each key. This allows you to have identical keys for different areas of your system.

### Loading your config files

[](#loading-your-config-files)

Once you have created the config object, you need to load the two config files. The config file needs to be writable, and both files will be created if they don't exist.

### Getting a value

[](#getting-a-value)

The `getValue` function returns the value of a given key:

```
getValue(string $key, [string $module]);

```

If the key is found in the config file, the value from there is returned. If not, the default file is checked and a value returned from there if available.

If the key is not found in either file, the function will return `false`

### Setting a value

[](#setting-a-value)

the `setValue` function behaves very similarly to the `getValue`

```
setValue(string $key, mixed $value, [string $module]);

```

The value is only ever stored in the config - the defaults are never touched.

At this point, the file itself it not saved, the value is only stored in-memory.

### Saving the config

[](#saving-the-config)

The `save` function saves the in-memory config to the config file.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

2825d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/41cf0cacc86d2eb2bad1af040e198a0170ca71ca9c5943212b7c183bc833238d?d=identicon)[geeksareforlife](/maintainers/geeksareforlife)

---

Top Contributors

[![geeksareforlife](https://avatars.githubusercontent.com/u/1926944?v=4)](https://github.com/geeksareforlife "geeksareforlife (10 commits)")

### Embed Badge

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

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

###  Alternatives

[brumann/polyfill-unserialize

Backports unserialize options introduced in PHP 7.0 to older PHP versions.

343.8M1](/packages/brumann-polyfill-unserialize)[knplabs/knp-disqus-bundle

6280.6k](/packages/knplabs-knp-disqus-bundle)[iwanli/wxxcx

A WeChat applet (xiaochengxu) plugins for Laravel 5.

12119.4k](/packages/iwanli-wxxcx)[scuttlebyte/laravel-request-context

Store and access contextual request data with ease

1573.0k](/packages/scuttlebyte-laravel-request-context)

PHPackages © 2026

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