2017 © Pedro Peláez
 

library config

The Modus Configuration class, supporting various local and global configuration settings for the Modus framework.

image

modus/config

The Modus Configuration class, supporting various local and global configuration settings for the Modus framework.

  • Friday, February 26, 2016
  • by brandonsavage
  • Repository
  • 1 Watchers
  • 0 Stars
  • 44 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Modus/Config

The Modus/Config package is designed to provide a simple, basic configuration layer and DI container setup mechanism for any project., (*1)

Installing

To install this package, run the following command:, (*2)

composer require modus/config

Dependencies

This module depends on the phpdotenv project. No other dependencies are installed., (*3)

Usage

Using the configuration package is simple., (*4)

The package will automatically attempt to load up to three configuration files on each instantiation, based on the following rules:, (*5)

  1. config.php
  2. The specific environment specified
  3. local.php

For example, if the environment specified is "production", then Modus/Config will load config.php, then production.php, then local.php., (*6)

Modus/Config is smart enough to override the early files with later configuration files. So for example, if you load a file with an array key of 'database' set to null, and in a later configuration set that value to the name of your MySQL database, Modus/Config will compile a configuration that contains the correct value., (*7)

For example, imagine the two following configuration files:, (*8)

# config.php
return [
    'database' => null,
    'useMysql' => false,
    'userEmail' => 'user@example.com',
];
#local.php
return [
    'database' => 'myDb',
    'useMysql' => true,
    'storeEmail' => 'user2@example.com',
];

When Modus/Config evaluates them together, it will create the following configuration:, (*9)

#evaluated config
return [
    'database' => 'myDb',
    'useMysql' => true,
    'storeEmail' => 'user2@example.com',
    'userEmail' => 'user@example.com',
];

In addition, Modus/Config is recursive, so multidimensional arrays will be merged correctly., (*10)

Environment Variables

Modus/Config allows you to optionally include the PHP Dotenv project, and define environment variables. This is useful for setting server-specific settings like passwords, keys, database names and server locations., (*11)

The Versions

26/02 2016

dev-master

9999999-dev

The Modus Configuration class, supporting various local and global configuration settings for the Modus framework.

  Sources   Download

MIT

The Development Requires

10/10 2015

1.0

1.0.0.0

The Modus Configuration class, supporting various local and global configuration settings for the Modus framework.

  Sources   Download

MIT

The Requires

 

The Development Requires