https://github.com/schwabnicolas/configmgr
A PHP configuration manager.
https://github.com/schwabnicolas/configmgr
configuration configuration-files configuration-management php php74 web
Last synced: 2 months ago
JSON representation
A PHP configuration manager.
- Host: GitHub
- URL: https://github.com/schwabnicolas/configmgr
- Owner: SchwabNicolas
- Created: 2020-08-20T08:05:52.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-01T12:33:53.000Z (over 5 years ago)
- Last Synced: 2025-03-25T05:43:43.669Z (12 months ago)
- Topics: configuration, configuration-files, configuration-management, php, php74, web
- Language: PHP
- Homepage:
- Size: 47.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ConfigMGR
ConfigMGR is a Configuration Manager for PHP. It is meant to remove all these old ``config.php`` files in a simple and efficient way.
## Install with Composer
You can install this library with [Composer](https://getcomposer.org).
```
composer require nschwab/configmgr
```
## Simple example
You can find a simple example in the ``/example/`` directory.
## String interpolation
String interpolation is possible within your config file. By using curly brackets "{ }", you can specify any variable or constants defined in your config. It will look for constants defined by the system before checking for configuration keys.
### Example
```json
{
"constants": {
"DB_NAME": "testDb",
"SQL_USER": "root",
"SQL_HOST": "localhost",
"SQL_PASSWORD": "123456",
"CONNECTION_STRING": "Server={SQL_HOST}; Database={DB_NAME}; User Id={SQL_USER}; Password={SQL_PASSWORD}",
"VERSION": "v1.7.3-alpha {PHP_VERSION}"
}
}
```
## Features
- [x] Loading configuration from JSON
- [x] Creating variables from configuration
- [x] Defining constants from configuration
- [x] Format content of a configuration key with another
- [x] Format content of multiple configuration keys with another
- [x] Composer package
- [x] Search to format content with already defined constants
- [x] Custom markup
- [x] Crawl recursively through tables to format content with configuration keys
- [x] Crawl recursively through objects to format content with configuration keys
- [ ] Load tables from CSV
- [ ] Load objects from JSON
- [ ] Monolog integration