Download the PHP package abdeslam/configuration-manager without Composer
On this page you can find all versions of the php package abdeslam/configuration-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package configuration-manager
ConfigurationManager package
ConfigurationManager is a simple, powerful and flexible PHP, JSON and XML configuration file loader.
Table of contents
- Requirements
- Installation
- 1. Using Composer
- 2. Manually
- Usage
- 1. using the class ConfigurationManager
- 2. using the static factory
- Accessing values
- Customization
Requirements
- php: ^8.0
Installation
1. Using Composer
You can install the library via Composer.
or
2. Manually
If you're not using Composer, you can also clone Abdeslam/ConfigurationManager
repository into your directory:
However, using Composer is recommended as you can easily keep the library up-to-date.
Usage
1. using the class ConfigurationManager
let's assume that is your PHP configuration file :
or loading multiple configuration files :
to load multiple configuration files, add as many files as you want as arguments to the method ConfigurationManager::addLoader()
after the the first argument (the loader).
the available methods through the ConfigurationManager
:
2. using the static factory
to set a specific loader to use, pass one of the the following strings as a first argument to the ConfigurationManagerFactory::create()
static factory method:
- 'php': to use
PHPConfigurationLoader::class
as a default loader - 'json': to use
JSONConfigurationLoader::class
as a default loader - 'xml': to use
XMLConfigurationLoader::class
as a default loader
Accessing values
ConfigurationManager::get()
and ConfigurationManager::has()
have compound key resolving capability separated by '.' by default and the key separator can be changed, which means :
Customization
you can create your own configuration loader by creating a class that implements ConfigurationLoaderInterface::class
:
Made with love :heart: