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

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

duyler/config
=============

Duyler config file loader

0876PHPCI passing

Since Nov 25Pushed 5mo ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

[![Quality Gate Status](https://camo.githubusercontent.com/e31509e9f110eae5332ce811bdb0745a019df5ad3820387dcc23e8e1e757e34f/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6475796c65725f636f6e666967266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/summary/new_code?id=duyler_config)[![Coverage](https://camo.githubusercontent.com/1a039871524d61d34893f287b6bab1efb152405ce8510dd366ff4d312e3edf38/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6475796c65725f636f6e666967266d65747269633d636f766572616765)](https://sonarcloud.io/summary/new_code?id=duyler_config)[![Psalm Type Coverage](https://camo.githubusercontent.com/83a76a8574dad0f04f603dc10e05e22a53d344ab945e1c846c3794019292bae8/68747470733a2f2f73686570686572642e6465762f6769746875622f6475796c65722f636f6e6669672f636f7665726167652e737667)](https://shepherd.dev/github/duyler/config)[![PHP Version](https://camo.githubusercontent.com/28707ffc1ecc805c9570ef4f3f3819ae10e4de7e640d6f071e76152c0a4ac717/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6475796c65722f636f6e6669672f7068703f76657273696f6e3d6465762d6d61696e)](https://camo.githubusercontent.com/28707ffc1ecc805c9570ef4f3f3819ae10e4de7e640d6f071e76152c0a4ac717/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6475796c65722f636f6e6669672f7068703f76657273696f6e3d6465762d6d61696e)

Duyler Config
=============

[](#duyler-config)

### Description

[](#description)

Duyler Config is a powerful and flexible configuration management library for PHP applications. It provides a simple and intuitive way to handle configuration files and environment variables in your projects.

### Features

[](#features)

- Recursive configuration file loading
- Environment variables support with .env files
- Configuration caching for production environments
- Type-safe configuration values with typed getters
- Circular dependency detection
- Extensible through interfaces
- Clean architecture with SOLID principles
- PHP 8.4+ support

### Installation

[](#installation)

```
composer require duyler/config
```

### Basic Usage

[](#basic-usage)

```
use Duyler\Config\FileConfig;

// Initialize config
$config = new FileConfig(
    configDir: 'config',
    rootFile: 'composer.json'
);

// Get configuration value
$value = $config->get('app', 'name', 'default');

// Check if config key exists
if ($config->has('app', 'name')) {
    // ...
}

// Get all values from config file
$allConfig = $config->all('app');

// Type-safe getters
$timeout = $config->getInt('app', 'timeout', 30);
$debug = $config->getBool('app', 'debug', false);
$name = $config->getString('app', 'name', 'MyApp');
$servers = $config->getArray('app', 'servers', []);

// Get environment variable
$env = $config->env('APP_ENV', 'production');

// Get project path
$path = $config->path('storage/logs');
```

### Advanced Usage

[](#advanced-usage)

#### Configuration Caching

[](#configuration-caching)

For production environments, you can enable configuration caching:

```
$config = new FileConfig(
    configDir: 'config',
    rootFile: 'composer.json',
    cacheDir: 'var/cache',
    useCache: true
);

// Warm up cache (optional, useful for deployment)
$config->warmup();

// Clear cache when needed
$config->clearCache();
```

#### Cross-Config References

[](#cross-config-references)

Configuration files can reference values from other configs:

```
// config/app.php
return [
    'name' => 'MyApp',
    'database' => $config->get('database', 'default', 'mysql'),
];

// config/database.php
return [
    'default' => 'postgresql',
    'connections' => [
        'mysql' => ['host' => 'localhost'],
        'postgresql' => ['host' => 'localhost'],
    ],
];
```

The library automatically handles circular dependencies.

### Requirements

[](#requirements)

- PHP 8.4 or higher
- Composer

### Architecture

[](#architecture)

The library follows clean architecture principles and SOLID design:

- **ProjectRootFinder** - Locates project root directory
- **ConfigFileLoader** - Loads configuration files from filesystem
- **EnvironmentResolver** - Handles environment variables
- **ConfigCache** - Manages configuration caching
- **FileConfig** - Main facade for configuration access

### License

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance48

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/69f18edde71f0f80540eda4e097854eddf8eb3390f38ff2ad241b9daaf622281?d=identicon)[milinsky](/maintainers/milinsky)

---

Top Contributors

[![milinsky](https://avatars.githubusercontent.com/u/17288321?v=4)](https://github.com/milinsky "milinsky (50 commits)")

### Embed Badge

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

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

###  Alternatives

[akaunting/laravel-setting

Persistent settings package for Laravel

495805.1k7](/packages/akaunting-laravel-setting)[qcod/laravel-gamify

Add gamification in laravel app with reputation point and badges support

680347.0k1](/packages/qcod-laravel-gamify)[kartik-v/yii2-widget-sidenav

An enhanced side navigation menu styled for bootstrap (sub repo split from yii2-widgets)

364.0M8](/packages/kartik-v-yii2-widget-sidenav)[parallax/filament-comments

Add comments to your Filament Resources.

130222.1k2](/packages/parallax-filament-comments)[sop/crypto-encoding

A PHP implementation of textual encodings of cryptographic structures.

161.4M27](/packages/sop-crypto-encoding)[eiriksm/site-schema

Allows you to get the complete picture of a site schema, to use for CI for example

111.4M](/packages/eiriksm-site-schema)

PHPackages © 2026

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