nschwab / configmgr
A PHP configuration manager.
v0.0.1-alpha
2020-08-26 13:10 UTC
Requires
- php: >=7.4.0
- ext-json: *
This package is auto-updated.
Last update: 2025-04-29 01:33:30 UTC
README
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.
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
{ "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
- Loading configuration from JSON
- Creating variables from configuration
- Defining constants from configuration
- Format content of a configuration key with another
- Format content of multiple configuration keys with another
- Composer package
- Search to format content with already defined constants
- Custom markup
- Crawl recursively through tables to format content with configuration keys
- Crawl recursively through objects to format content with configuration keys
- Load tables from CSV
- Load objects from JSON
- Monolog integration