PHPackages                             solophp/configs - 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. solophp/configs

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

solophp/configs
===============

Simple and flexible configuration management library with dot notation support

v2.0.0(9mo ago)075MITPHPPHP &gt;=8.1

Since Oct 16Pushed 9mo ago1 watchersCompare

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

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Solo Configs
============

[](#solo-configs)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8fc0f2e8d18fdce3c831a3bb65df0c084a341d41a1cb612b74558d1def30cd64/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6c6f7068702f636f6e666967732e737667)](https://packagist.org/packages/solophp/configs)[![License](https://camo.githubusercontent.com/0d5b8414993b4dff1dfbc1ab097dc5cd9ba3879038d7a43ca8ac5e8e77b679f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736f6c6f7068702f636f6e666967732e737667)](https://github.com/solophp/configs/blob/main/LICENSE)[![PHP Version](https://camo.githubusercontent.com/b6adadb5fdf88c925bc4d714cd370a157c723b97c566f266452089b6112ff220/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736f6c6f7068702f636f6e666967732e737667)](https://packagist.org/packages/solophp/configs)

Solo Configs is a simple PHP package for managing configuration settings in your application. It provides easy access to configuration values using dot notation and supports default values if a key is not found.

Requirements
------------

[](#requirements)

- PHP 8.1 or higher

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

[](#installation)

You can install the package via Composer:

```
composer require solophp/configs
```

Usage
-----

[](#usage)

Create an instance of `Configs` by passing an array of configurations. You can then retrieve values using dot notation.

### Basic Usage

[](#basic-usage)

```
use Solo\Configs\Configs;

// Create a new instance with your configurations
$configs = new Configs([
    'database' => [
        'host' => 'localhost',
        'username' => 'root',
        'password' => 'secret',
    ],
    'app' => [
        'name' => 'My Application',
        'debug' => true,
        'settings' => [
            'timezone' => 'UTC'
        ]
    ]
]);

// Get values using dot notation
$dbHost = $configs->get('database.host');          // 'localhost'
$appName = $configs->get('app.name');             // 'My Application'
$timezone = $configs->get('app.settings.timezone'); // 'UTC'

// Using default values
$cache = $configs->get('cache.enabled', false);    // false (using default)

// Get entire sections
$dbConfig = $configs->get('database');    // Returns entire database array
$allConfigs = $configs->get();           // Returns all configurations

// Note: Magic method access is limited in PHP due to property name restrictions
// It's recommended to use the get() method directly for best compatibility
```

### Configuration Structure

[](#configuration-structure)

Your configuration array can be as deeply nested as needed:

```
$configs = new Configs([
    'session' => [
        'lifetime' => 86400,
        'options' => [
            'secure' => true,
            'httponly' => true,
            'samesite' => 'Lax'
        ]
    ],
    'cache' => [
        'driver' => 'redis',
        'connection' => [
            'host' => 'localhost',
            'port' => 6379
        ]
    ]
]);
```

API Reference
-------------

[](#api-reference)

### Methods

[](#methods)

#### Constructor

[](#constructor)

```
public function __construct(array $configs)
```

Creates a new Configs instance.

**Parameters:**

- `array $configs`: Configuration array

#### Get Configuration Value

[](#get-configuration-value)

```
public function get(string $key = '', mixed $default = null): mixed
```

Retrieves a configuration value using dot notation.

**Parameters:**

- `string $key`: Configuration key using dot notation (optional)
- `mixed $default`: Default value if key not found

**Returns:** Configuration value or default if not found

#### Magic Property Access

[](#magic-property-access)

```
public function __get(string $key): mixed
```

Magic method for property access (limited functionality in PHP).

**Parameters:**

- `string $key`: Configuration key

**Returns:** Configuration value or null if not found

**Note:** Due to PHP limitations with property names containing special characters, it's recommended to use the `get()` method directly.

Development
-----------

[](#development)

### Running Tests

[](#running-tests)

```
composer test
```

### Code Style

[](#code-style)

Check code style:

```
composer cs
```

Fix code style:

```
composer cs-fix
```

License
-------

[](#license)

This package is open-source and available under the [MIT License](LICENSE).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance56

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Total

3

Last Release

289d ago

Major Versions

v1.1.0 → v2.0.02025-08-02

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

v1.1.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f29817cec408d033cd4441c8f760e3ae40248dc0f66856a09080d282aee6959?d=identicon)[Vitaliy Olos](/maintainers/Vitaliy%20Olos)

---

Top Contributors

[![SoloPHP](https://avatars.githubusercontent.com/u/175482616?v=4)](https://github.com/SoloPHP "SoloPHP (7 commits)")

---

Tags

phpconfigurationSettingsarraydot notationconfigs

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/solophp-configs/health.svg)

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

###  Alternatives

[pharaonic/php-dot-array

Access array data quickly/easily using dot-notation and asterisk.

1011.6k3](/packages/pharaonic-php-dot-array)[michaels/data-manager

Simple data manager for nested data, dot notation array access, extendability, and container interoperability.

121.9k2](/packages/michaels-data-manager)

PHPackages © 2026

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