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

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

carry0987/config
================

A library for easily manipulating config of php program

1.1.0(1y ago)057MITPHPPHP &gt;=7.4

Since Jan 29Pushed 1y ago1 watchersCompare

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

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

PHP-Config
==========

[](#php-config)

[![Packgist](https://camo.githubusercontent.com/7f2a31817770502499871daef19c3722fc1070f8cd9abac4b707a7a3ef35fb46/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6361727279303938372f636f6e6669672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/carry0987/config)
A library for easily manipulating config of php program

Overview
--------

[](#overview)

PHP-Config is a versatile library designed to simplify the manipulation and management of configurations within PHP applications. Whether it's handling configurations stored in a database, processing configurations for runtime use, or integrating with caching systems like Redis, PHP-Config streamlines your workflow.

Features
--------

[](#features)

- Easy retrieval and updating of configuration settings.
- Support for fetching configurations from a database using PDO.
- Optional integration with Redis for caching configuration values.
- Customizable table name for configurations stored in the database.
- Robust error handling through custom exceptions.
- Type-safe operations with modern PHP type declarations.

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

[](#requirements)

- PHP 7.4 or higher
- PDO extension for database interaction
- Optional: Redis server and PHP extension for Redis, if caching is desired

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

[](#installation)

To integrate PHP-Config into your project, you can clone this repository and include it directly, or use Composer to manage the dependency.

To install using Composer:

```
composer require carry0987/config

```

Usage
-----

[](#usage)

### Initialization

[](#initialization)

Below is an example of how to initialize the `Config` class with a PDO connection:

```
use carry0987\Config\Config;
use carry0987\Redis\RedisTool;

// Assuming $pdo is an instance of PDO
$config = new Config($pdo);

// Optionally, you can set a custom table name for the configuration.
$config->setTableName('your_custom_config_table');
```

### Redis Integration (Optional)

[](#redis-integration-optional)

If you have Redis set up and would like to utilize it for configuration caching:

```
// Assuming $redis is an instance of RedisTool
$config->setRedis($redis);
```

### Adding a Configuration Setting

[](#adding-a-configuration-setting)

```
// To add a new configuration setting:
$result = $config->addConfig('site_name', 'My Awesome Website');
```

### Retrieving a Configuration Setting

[](#retrieving-a-configuration-setting)

```
// To fetch a configuration value by its key:
$siteName = $config->getConfig('site_name', true);
```

### Updating a Configuration Setting

[](#updating-a-configuration-setting)

```
// To update an existing configuration setting:
$result = $config->updateConfig('site_name', 'My Even More Awesome Website');
```

Contributing
------------

[](#contributing)

Contributions to PHP-Config are welcome. Please feel free to fork the repository and submit pull requests.

License
-------

[](#license)

PHP-Config is released under the MIT License. See the bundled LICENSE file for details.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

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

Total

3

Last Release

692d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f43bad259478092c4ff269518aa9a0c8e91a537a67272877041b4bc1f25cfe8?d=identicon)[carry0987](/maintainers/carry0987)

---

Top Contributors

[![carry0987](https://avatars.githubusercontent.com/u/12984973?v=4)](https://github.com/carry0987 "carry0987 (5 commits)")

### Embed Badge

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

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

PHPackages © 2026

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