PHPackages                             ctorh23/configmanager - 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. ctorh23/configmanager

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

ctorh23/configmanager
=====================

Configuration management library for PHP applications.

v1.1.0(3mo ago)02MITPHPPHP ^8.3CI passing

Since Mar 13Pushed 3mo agoCompare

[ Source](https://github.com/ctorh23/configmanager)[ Packagist](https://packagist.org/packages/ctorh23/configmanager)[ RSS](/packages/ctorh23-configmanager/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

ConfigManager
=============

[](#configmanager)

**ConfigManager** is a lightweight library for managing PHP configuration files with support for Dot-Notation, Lazy Loading and Caching.

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

[](#installation)

The package requires **PHP 8.3** or newer.

```
composer require ctorh23/configmanager
```

Usage
-----

[](#usage)

### Configuration File Structure

[](#configuration-file-structure)

Create a PHP file, for example `app.php`, that looks like this:

```
return [
	'name' => 'My App',
	'env' => $this->env('APP_ENV', 'production'),
	'encryption' => [
		'cipher' => 'AES-256-GCM',
		'key' => $this->env('APP_KEY'),
	],
];
```

The file must return an array. As you can see, you can use environment variables as configuration settings. The second parameter of the `env()` method is a default value.

### Accessing Configuration Values

[](#accessing-configuration-values)

Assuming your configuration files are saved in a `config/` directory, you must pass the path to this directory to instantiate a `ConfigManager` object:

```
use Ctorh23\ConfigManager\ConfigManager;

$confMan = new ConfigManager(__DIR__ . '/config');

echo $confMan->get('app.name'); //Output: My App
echo $confMan->get('app.env'); //Output: production
echo $confMan->get('app.encryption.cipher'); //Output: AES-256-GCM

// Passing a default value as a second parameter
echo $confMan->get('app.logs', 'logs/'); //Output: logs/
```

You can also dynamically set configuration settings, but you should keep in mind that they are not persisted on the filesystem:

```
$confMan->set('timezone', 'UTC');
$confMan->set('app.encryption.cipher', 'AES-XTS');

echo $confMan->get('timezone'); //Output: UTC
echo $confMan->get('app.encryption.cipher'); //Output: AES-XTS
```

### Caching

[](#caching)

A configuration file is loaded once per request. When you have multiple configuration files, this can cause unnecessary filesystem access. In production, it is recommended to cache the configuration settings. A cache directory must be passed as the second argument to the `ConfigManager` constructor:

```
$confMan = new ConfigManager(__DIR__ . '/config', __DIR__ . '/cache');
$confMan->warmUpCache();
```

With caching enabled, the cached configuration file is loaded only once when a `ConfigManager` object is instantiated. If you change a setting or add a new configuration file, those changes will not be available until the cache file is deleted.

Call the `warmUpCache()` method as part of your deployment process. You do not need to manually delete an old cache file beforehand - it will be overwritten.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance82

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

Total

2

Last Release

91d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/54403634?v=4)[ctorh23](/maintainers/ctorh23)[@ctorh23](https://github.com/ctorh23)

---

Top Contributors

[![ctorh23](https://avatars.githubusercontent.com/u/54403634?v=4)](https://github.com/ctorh23 "ctorh23 (3 commits)")

### Embed Badge

![Health badge](/badges/ctorh23-configmanager/health.svg)

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

###  Alternatives

[spatie/laravel-support-bubble

A non-intrusive support chat bubble that can be displayed on any page

395192.5k](/packages/spatie-laravel-support-bubble)[wp-forge/wp-update-handler

A WordPress package for updating custom plugins and themes based on an API response from a custom update server.

14155.3k](/packages/wp-forge-wp-update-handler)[adhocore/underscore

PHP underscore inspired &amp;amp;/or cloned from \_.js

435.1k](/packages/adhocore-underscore)[davidrjenni/scip-php

SCIP Code Intelligence Protocol (SCIP) indexer for PHP

171.9k](/packages/davidrjenni-scip-php)

PHPackages © 2026

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