Framework Agnostic Configuration Library

2.2 2021-11-02 13:58 UTC

This package is auto-updated.

Last update: 2021-12-02 15:02:20 UTC


Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Conphigure is a framework agnostic library for reading and retrieving configuration. If your application has outgrown a single configuration file this library will be a good choice.

It can read configuration files in the following formats:

  • php
  • yaml
  • json
  • xml
  • ini
  • dotenv

Conphigure can also read entire directories containing configuration files.


Via Composer

$ composer require thewunder/conphigure


If you have configuration in myfile.yml

  port: 25

Read it in your php application like the following

$config = Conphigure::create();

//load configuration from a single file

//get a value
$port = $config->get('smtp/port');

//add configuration from somewhere else (cache / database / etc)
$arrayFromSomewhere = [
     'database' => [
         'host' => 'localhost'

//you can also use it like an array
$host = $config['database']['host'];
$host = $config['database/host'];

//throws an exception if a value is missing
$value = $config->get('missing/key');

When reading a config directory Conphigure will (by default) organize the configuration in each file into a common root based on the file path.

For example, a directory /directory/config/ with:

  • system.yml
  • email.yml
  • logging.yml
  • subdirectory/something.yml
//read the directory

//get all configuration as an array
$all = $config->all();
/* The result will be:
    'system' => ['...'], //contents of system.yml
    'email' => ['...'], //contents of email.yml
    'logging' => ['...'], //contents of logging.yml
    'subdirectory' => [
        'something' => ['...'], //contents of subdirectory/something.yml

This allows you to keep things organized, and keep each file very flat.

Change log

Please see CHANGELOG for more information on what has changed recently.


$ composer test


Please see CONTRIBUTING for details.



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