bogosoft/configuration

Application configuration contracts and minimal implementations for PHP 7.4+

3.0.0 2019-12-20 00:40 UTC

This package is auto-updated.

Last update: 2024-04-20 10:36:25 UTC


README

This library contains contracts and implementations for working with application configurations.

Requirements

  • PHP 7.4+
  • bogosoft/core

Installation

composer require bogosoft/configuration

Usage

#
# Start with an array of values.
#
$values = [
    'database:customers:host'     => 'db.example.com',
    'database:customers:password' => '12345',
    'database:customers:port'     => '3306',
    'database:customers:username' => 'root'
];

#
# Convert the array into a configuration.
#
$config = new Bogosoft\Configuration\SimpleConfiguration($values);

#
# Values can be access from the configuration as if it were an array.
#
$port = $config->get('database:customers:port'); // Returns, '3306'.