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

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

andrewdyer/php-settings
=======================

A simple, framework-agnostic settings container for PHP applications

01PHPCI passing

Since Mar 12Pushed 1w agoCompare

[ Source](https://github.com/andrewdyer/php-settings)[ Packagist](https://packagist.org/packages/andrewdyer/php-settings)[ RSS](/packages/andrewdyer-php-settings/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

⚙️ Settings
===========

[](#️-settings)

A simple, framework-agnostic settings container for PHP applications.

⚖️ License
----------

[](#️-license)

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

✨ Introduction
--------------

[](#-introduction)

This library provides a lightweight wrapper around a plain PHP array, giving you a clean interface for storing and retrieving application configuration values. It offers a straightforward, dependency-free way to manage configuration without coupling your code to a specific framework, making it easy to drop into any project or architecture.

📥 Installation
--------------

[](#-installation)

```
composer require andrewdyer/php-settings
```

Requires PHP 8.3 or newer.

🚀 Getting Started
-----------------

[](#-getting-started)

Create a `Settings` instance by passing in your configuration array.

```
declare(strict_types=1);

use Anddye\Settings\Settings;

$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)

Get the entire settings array using the `all()` method.

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

### Retrieve a setting

[](#retrieve-a-setting)

Access a top-level setting using 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)

Check if a top-level key exists using the `has()` method.

```
$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'
```

###  Health Score

21

—

LowBetter than 21% of packages

Maintenance64

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

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/666597ea6e46748a89fe8764d1a45b4d0da97daf1bb1e9770ea34ae41f706d08?d=identicon)[andrewdyer](/maintainers/andrewdyer)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[woocommerce/wc-smooth-generator

A smooth product, order, customer, and coupon generator for WooCommerce.

37018.8k](/packages/woocommerce-wc-smooth-generator)[codelicia/xulieta

Xulieta is a light php binary that lint documentation snippets

6713.2k4](/packages/codelicia-xulieta)

PHPackages © 2026

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