PHPackages                             andrewdyer/settings - 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. andrewdyer/settings

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

andrewdyer/settings
===================

A framework-agnostic PHP settings library for managing application configuration in a consistent and structured way

0.1.6(3w ago)0102MITPHPPHP ^8.3CI passing

Since Mar 31Pushed 1w agoCompare

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

READMEChangelog (9)Dependencies (6)Versions (9)Used By (0)

Settings
========

[](#settings)

A framework-agnostic library for managing application configuration in a consistent and structured way.

[![Latest Stable Version](https://camo.githubusercontent.com/e7f16de34eef61920791c17020d034302cd046d808d94f20db07b2c7e6e1d0d5/687474703a2f2f706f7365722e707567782e6f72672f616e64726577647965722f73657474696e67732f763f7374796c653d666c61742d737175617265)](https://packagist.org/packages/andrewdyer/settings)[![Total Downloads](https://camo.githubusercontent.com/bcda40d5b474d50fef804f50a7c50f71c2e144cc066c5a0c7826aa262bb41fb8/687474703a2f2f706f7365722e707567782e6f72672f616e64726577647965722f73657474696e67732f646f776e6c6f6164733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/andrewdyer/settings)[![License](https://camo.githubusercontent.com/2e5868c7dc8f633b30172be95b2706bb61236f7620234629bafdadec5bef8665/687474703a2f2f706f7365722e707567782e6f72672f616e64726577647965722f73657474696e67732f6c6963656e73653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/andrewdyer/settings)[![PHP Version Require](https://camo.githubusercontent.com/86dd62e0a0c277df127e8ca66952bbcafa4f0c0db088296821f340967a1fb95c/687474703a2f2f706f7365722e707567782e6f72672f616e64726577647965722f73657474696e67732f726571756972652f7068703f7374796c653d666c61742d737175617265)](https://packagist.org/packages/andrewdyer/settings)

Introduction
------------

[](#introduction)

This library wraps a plain array behind a clean interface for accessing and reading configuration values, offering a straightforward, dependency-free way to keep settings organised across a codebase. It avoids coupling application code to a specific framework, making it easy to drop into any project or architecture regardless of how configuration is sourced or loaded.

Prerequisites
-------------

[](#prerequisites)

- **[PHP](https://www.php.net/)**: Version 8.3 or higher is required.
- **[Composer](https://getcomposer.org/)**: Dependency management tool for PHP.

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

[](#installation)

```
composer require andrewdyer/settings
```

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

[](#getting-started)

Create a `AndrewDyer\Settings\Settings` instance by passing in the configuration array.

```
$settings = new Settings([
    'app_name' => 'My Application',
    'database' => [
        'host' => 'localhost',
        'port' => 5432,
        'credentials' => [
            'username' => 'admin',
            'password' => 'secret',
        ],
    ],
]);
```

Usage
-----

[](#usage)

### Retrieve all settings

[](#retrieve-all-settings)

The entire settings array is returned by the `all()` method.

```
$all = $settings->all();
```

### Retrieve a setting

[](#retrieve-a-setting)

A top-level setting is accessed by its key with the `get()` method.

```
$appName = $settings->get('app_name'); // 'My Application'
```

The `get()` method can also access nested settings using dot notation.

```
$host = $settings->get('database.host'); // 'localhost'
```

Dot notation can traverse multiple levels of configuration.

```
$username = $settings->get('database.credentials.username'); // 'admin'
```

Requesting a parent key with `get()` returns the entire nested configuration array.

```
$database = $settings->get('database');
```

### Check if a setting exists

[](#check-if-a-setting-exists)

The `has()` method checks whether a top-level key exists.

```
$settings->has('app_name'); // true
```

The `has()` method also supports nested keys using dot notation.

```
$settings->has('database.credentials.password'); // true
```

### Literal keys containing dots

[](#literal-keys-containing-dots)

If a top-level key contains dots, the exact key takes precedence over nested resolution.

```
$settings = new Settings([
    'database.host' => 'literal',
]);

$settings->get('database.host'); // 'literal'
```

If the exact key does not exist, the `get()` method falls back to resolving nested values using dot notation.

```
$settings = new Settings([
    'database' => [
        'host' => 'nested',
    ],
]);

$settings->get('database.host'); // 'nested'
```

License
-------

[](#license)

Licensed under the [MIT license](https://opensource.org/licenses/MIT) and is free for private or commercial projects.

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance97

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

7

Last Release

26d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/666597ea6e46748a89fe8764d1a45b4d0da97daf1bb1e9770ea34ae41f706d08?d=identicon)[andrewdyer](/maintainers/andrewdyer)

---

Top Contributors

[![andrewdyer](https://avatars.githubusercontent.com/u/8114523?v=4)](https://github.com/andrewdyer "andrewdyer (38 commits)")

---

Tags

configconfigurationframework-agnosticphpsettingsphpconfigurationSettingsconfigframework agnostic

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/andrewdyer-settings/health.svg)

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

###  Alternatives

[jbtronics/settings-bundle

A symfony bundle to easily create typesafe, user-configurable settings for symfony applications

9558.8k3](/packages/jbtronics-settings-bundle)[selective/config

Config component, strictly typed

16191.9k3](/packages/selective-config)

PHPackages © 2026

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