A PHP Generic Configuration Object

2.1.0 2019-11-13 23:17 UTC


A Configuration Loader for PHP Packages

Build Status Latest Stable Version License Coverage Status StyleCI Total Downloads Latest Unstable Version

This package is a standalone library to allow you to have easy setup and access to configuration variables in your own php packages.



  • 7.2
  • 7.3


composer require eig/configurator


Include the Configurator class in your application:

use eig\Configurator\Configurator as Config;

Now call instantiate a copy:

$config = new Config("path/to/files");

or load in an array of values

$config = new Config($array, $key); You can mix and match methods of loading config values.

Now you can reference your configuration variable loaded from the files supplied with dot notation on the config object:


You also have access to several methods: all() -> returns all items get($key) -> returns the item at the key, may be dot notation has($key) -> returns boolean (True/False) if the value exists, may use dot notation load($value, $key) -> load more values into the config object, **Note: $key is only required for adding an array of values. For adding files the file name is used as the top level key.


To use the library through a Facade use eig\Configurator\Facades\Configurator Then in your code you can load and access your configuration values like so:

* This mehtod is required first to access any configuration values
* Failing to load first will return a null to any calls to items() or get()


* This method will return all items that are loaded as an array.

* This method will return the item you specify just like using the array notation on a
* regular Configurator instance

 * This method will return true or false if the value exists in the config object

 * This method sets the value provided to the key
Configurator::set($key, $value)


To contribute to this project clone the github repository create a new branch with the feature you are creating or bug you are fixing. Write tests to prove your feature or bugfix works then submit a pull request on github.