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

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

nitier/config-loader
====================

0.9.9(1y ago)01PHP

Since Mar 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Nitier/ConfigLoader)[ Packagist](https://packagist.org/packages/nitier/config-loader)[ RSS](/packages/nitier-config-loader/feed)WikiDiscussions main Synced 1mo ago

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

Nitier ConfigLoader
===================

[](#nitier-configloader)

**A flexible configuration loader for PHP projects** with support for multiple formats and easy extensibility.

📦 Installation
--------------

[](#-installation)

```
composer require nitier/config-loader
```

🌟 Features
----------

[](#-features)

- Supports multiple formats: `.php`, `.json`, `.env`
- Deep configuration merging
- Easy integration of custom loaders
- Automatic type conversion for `.env` files
- PSR-4 compatible

🚀 Quick Start
-------------

[](#-quick-start)

### Basic Usage

[](#basic-usage)

```
use Nitier\ConfigLoader\Config;

// Load a single configuration file
$config = Config::load('/path/to/config.php');

// Load multiple files with overrides
$config = Config::load([
    '/path/to/base.json',
    '/path/to/override.env'
]);
```

Example `.env` File
-------------------

[](#example-env-file)

```
APP_DEBUG=true
DB_HOST=localhost
DB_PORT=3306
```

🔌 Available Loaders
-------------------

[](#-available-loaders)

FormatClassSupported ExtensionsPHP`PhpLoader``.php`, `.inc`JSON`JsonLoader``.json`ENV`EnvLoader``.env`🛠 Extending Functionality
-------------------------

[](#-extending-functionality)

### Adding a Custom Loader

[](#adding-a-custom-loader)

1. Create a class implementing `LoaderInterface`:

```
namespace App\ConfigLoaders;
use Nitier\ConfigLoader\Interface\LoaderInterface;

class XmlLoader implements LoaderInterface
{
    public static function supports(string $extension): bool
    {
       return $extension === 'xml';
    }

    public static function load(string $path): array
    {
        // Your XML parsing implementation here
    }
}
```

2. Register the loader:

```
Config::addLoader(\App\ConfigLoaders\XmlLoader::class);
```

⚙️ Configuration
----------------

[](#️-configuration)

### Loader Priorities

[](#loader-priorities)

Loaders are checked in the order they were registered. The most recently added loaders take priority.

### Deep Merging

[](#deep-merging)

When loading multiple configuration files, arrays are merged recursively:

```
// base.php
['db' => ['host' => 'localhost', 'user'=> 'test']]

// override.php
['db' => ['user'=> 'prod', 'port' => 3306]]

// Result
['db' => ['host' => 'localhost', 'user'=> 'prod', 'port' => 3306]]
```

📜 License
---------

[](#-license)

MIT

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance46

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 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

420d ago

### Community

Maintainers

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

---

Top Contributors

[![Nitier](https://avatars.githubusercontent.com/u/185420306?v=4)](https://github.com/Nitier "Nitier (5 commits)")

### Embed Badge

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

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

###  Alternatives

[orchestra/canvas

Code Generators for Laravel Applications and Packages

20917.2M158](/packages/orchestra-canvas)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)

PHPackages © 2026

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