2017 © Pedro Peláez
 

library configuration-manager

SlabPHP Configuration Manager

image

slabphp/configuration-manager

SlabPHP Configuration Manager

  • Monday, February 12, 2018
  • by ericsalerno
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

configuration-manager

SlabPHP Configuration Manager Library. This is an extracted version of the configuration utility from the Slab framework. It is designed to work with "PHP Configuration files"., (*1)

Installation

Include this project with composer:, (*2)

composer require slabphp/configuration-manager

Usage

Create and configure the manager., (*3)

$manager = new \Slab\Configuration\Manager($configuration);
$manager
    ->setFileDirectories(['/some/directory', '/some/other/directory'])
    ->loadConfiguration();

This will instantiate a configuration manager that will look for "php configuration" files in the following directories:, (*4)

  • /some/directory/default.php
  • /some/directory/override.php
  • /some/other/directory/default.php
  • /some/other/directory/override.php

The values in each will override the previously read files. You can use the secondary files to use stages based on an environment variable or server name., (*5)

Assuming this is the contents of the "php configuration" file at /some/directory/default.php:, (*6)

<?php

$config['someValue'] = true;
$config['something'] = [
    'something' => 'something else',
    'subValue' => [
        'thing' => 'fromage'
    ]
];

You would have available to you the following values in your calling code:, (*7)

echo $manager->someValue; //outputs true (or 1, whatever php)
echo $manager->something->something; //outputs 'something else'
echo $manager->something->subValue->thing; //outputs 'fromage'

Library Caveats

You can feel free to use this, submit bugs, contact us, or submit change requests. The SlabPHP framework is largely in maintenance mode at the moment and is in the process of being released open source under the Apache 2.0 license. We're well aware that better alternatives exist in this day and age, please see the SlabPHP main documentation for more details., (*8)

The Versions

12/02 2018

dev-master

9999999-dev https://www.salernolabs.com/slab

SlabPHP Configuration Manager

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

php configuration manager slab slabphp

12/02 2018

v0.1.0

0.1.0.0 https://www.salernolabs.com/slab

SlabPHP Configuration Manager

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

php configuration manager slab slabphp

12/02 2018

v0.1.1

0.1.1.0 https://www.salernolabs.com/slab

SlabPHP Configuration Manager

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

php configuration manager slab slabphp

12/02 2018

v0.1.2

0.1.2.0 https://www.salernolabs.com/slab

SlabPHP Configuration Manager

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

php configuration manager slab slabphp