dev-master
9999999-devMinimal, reusable Config component (without namespaces)
MIT
The Requires
The Development Requires
v0.1.0
0.1.0.0Minimal, reusable Config component (without namespaces)
MIT
The Requires
The Development Requires
Minimal, reusable Config component (without namespaces)
Config component that does not use namespaces, to be used in PHP 5.2 projects., (*1)
Bright Nucleus Config 5.2 is a Config component similar to brightnucleus/config, but it does not use PHP namespaces, so that it can be used in projects that need to work on PHP 5.2., (*3)
As it uses Composer, it will need PHP 5.3.2+ to use during development. However, there's a PHP 5.2 autoloader file that is generated, so that you only need PHP 5.2+ at runtime., (*4)
This is a very reduced form of a Config component, though, and is meant to provide a very basic way for PHP 5.2 libraries to read existing config files. There's no default values, no validation, no fancy convenience functions., (*5)
To include the library in your project, you can use Composer:, (*6)
composer require brightnucleus/config-52
Alternatively, you can copy the classes inside of your application and make sure that your application can find them., (*7)
To use the component within your project, you should first load the 5.2 autoloader:, (*8)
require dirname(__FILE__) . '/vendor/autoload_52.php';
Here's an example of how to use the class once it's been loaded:, (*9)
<?php use BrightNucleus_ConfigInterface as ConfigInterface; use BrightNucleus_Config as Config; class WorldGreeter { /** @var @var ConfigInterface */ protected $config; public function __construct(ConfigInterface $config) { $this->config = $config; } public function greet() { $hello = $this->config->getKey('hello'); $world = $this->config->getKey('world'); echo "$hello $world"; } } $config_file = dirname(__FILE__) . '/config/greetings.php'; $config = new Config(include($config_file)); $worldGreeter = new WorldGreeter($config); $worldGreeter->greet();
All feedback / bug reports / pull requests are welcome., (*10)
This code is released under the MIT license. For the full copyright and license information, please view the LICENSE file distributed with this source code., (*11)
Minimal, reusable Config component (without namespaces)
MIT
Minimal, reusable Config component (without namespaces)
MIT