A configuration repository for PHP.

Installs: 12

Dependents: 1

Stars: 3

Watchers: 1

Language: PHP

v1.0.1 2014-03-25 14:29 UTC


Build Status Total Downloads Latest Stable Version

A configuration repository for PHP projects.

Configure is a configuration repository for PHP projects. If your app depends on some sort of configuration settings, you can use Configure to handle them. It has a simple API and supports for different kinds of configuration file formats.


You can install Configure via Composer:

    "require": {
        "petersuhm/configure": "dev-master"

Basic usage

Using Configure is as simple as instantiating the ConfigurationRepository class and start adding settings to it:

$di->settings = new \Petersuhm\Configure\ConfigurationRepository();

$di->settings->set('template_path', '../templates');

Now you can start querying the repository:


// You can also provide a default value to be returned
$di->settings->get('not_set', 'default_value');

Configure also has supports for arrays:

    'lang' => 'da',
    'country' => 'dk'

// Multi dimensional arrays will be flattened using dot notation
    'localization' => [
        'lang' => 'da',
        'country' => 'dk'

Using configuration files

As of now, Configure supports YAML and PHP files.

# config.yml
    lang: da
    country: dk
app_name: Configure
# config.php

return array(

    'localization' => array(
        'lang' => 'da',
        'country' => 'dk'

    'app_name' => 'Configure'

In order to load the files, you need to create an instance of the relevant file loader class and provide it to the load() method on the repository:

$loader = new \Petersuhm\Configure\Loader\YamlFileLoader('config.yml');
// or
$loader = new \Petersuhm\Configure\Loader\ArrayFileLoader('config.php');




Configure is fully covered by unit tests. All code is written using a behavior driven approach with phpspec.

$ vendor/bin/phpspec run


Please see CONTRIBUTING for details.



The MIT License (MIT). Please see License File for more information.