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

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

php-strict/config
=================

Storage and loader for configuration object.

v1.0.0(7y ago)01202GPL-2.0-or-laterPHPPHP ^7.1

Since Apr 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/php-strict/config)[ Packagist](https://packagist.org/packages/php-strict/config)[ Docs](https://github.com/php-strict/config)[ RSS](/packages/php-strict-config/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (2)Used By (2)

Config
======

[](#config)

[![Software License](https://camo.githubusercontent.com/e1514dd3f2095dbf68a0008ae62a631142953ad2e86aa94c504343f2c2c191da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)[![Build Status](https://camo.githubusercontent.com/af84c9f771013be219319421032e76a6175abe56cf60bf3af53fc98eacefe586/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7068702d7374726963742f636f6e6669672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/php-strict/config)[![codecov](https://camo.githubusercontent.com/7cd836b1007bc9a624ee673340af48ba9b38858c7d85d9630afb5c3454d44ba4/68747470733a2f2f636f6465636f762e696f2f67682f7068702d7374726963742f636f6e6669672f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/php-strict/config)[![Codacy Badge](https://camo.githubusercontent.com/2e02301b8d4de6d92ea777e8a7b53ae796074160c163cce63d6e76498da7919e/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3933343861386466386363663437626362356236633131363935623763616333)](https://www.codacy.com/app/php-strict/config?utm_source=github.com&utm_medium=referral&utm_content=php-strict/config&utm_campaign=Badge_Grade)

Storage and loader for configuration object. Allows be initialised with defaults and load saved configuration from PHP, INI, JSON file.

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

[](#requirements)

- PHP &gt;= 7.1

Install
-------

[](#install)

Install with [Composer](http://getcomposer.org):

```
composer require php-strict/config
```

Usage
-----

[](#usage)

Define your own application configuration class by extending Config class:

```
use PhpStrict\Config\Config

class AppConfig extends Config
{
    /**
     * Project root
     *
     * @var string
     */
    public $root = '/';

    /**
     * Debug enable|disable
     *
     * @var bool
     */
    public $debug = false;

    /**
     * Database settings
     */
    public $dbServer = '';
    public $dbUser = '';
    public $dbPassword = '';
    public $dbName = '';
    public $dbCharset = '';
    public $dbTablePrefix = ''

    /*
     * another configuration fields here
     */

}
```

Example of configuration file content:

```
DEBUG=true

DB_SERVER=localhost
DB_USER=root
DB_PASSWORD=
DB_NAME=testproject
DB_CHARSET=utf8
DB_TABLE_PREFIX=

CACHE=true
```

Create and fill your configuration object with data from saved configuration file:

```
$config = new AppConfig();
$config->loadFromFile('config.ini');
```

Use configuration object fields directly on demand:

```
mysqli::__construct(
    $config->dbServer,
    $config->dbUser,
    $config->dbPassword,
    $config->dbName
);
```

Get subconfig by fields prefix:

```
$dbConfig = $config->getSlice('db');

mysqli::__construct(
    $dbConfig->server,
    $dbConfig->user,
    $dbConfig->password,
    $dbConfig->name
);
```

Tests
-----

[](#tests)

To execute the test suite, you'll need [Codeception](https://codeception.com/).

```
vendor\bin\codecept run
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

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

Unknown

Total

1

Last Release

2597d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f404fa292f952ba0429cfe11f608e982e0d9d645f2ac864c53abee7f71dff2b?d=identicon)[enikeishik](/maintainers/enikeishik)

---

Top Contributors

[![enikeishik](https://avatars.githubusercontent.com/u/2239913?v=4)](https://github.com/enikeishik "enikeishik (42 commits)")

---

Tags

configconfigurationphpphp-libraryphp7phpconfigurationconfigstrict

###  Code Quality

TestsCodeception

### Embed Badge

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

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

###  Alternatives

[caseyamcl/configula

A simple, but versatile, PHP config loader

42146.6k6](/packages/caseyamcl-configula)

PHPackages © 2026

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