italystrap / config
ItalyStrap Config Module - a simple and useful configuration package the OOP way
Installs: 2 441
Dependents: 10
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 5
Requires
- php: >=7.4
- ext-json: *
- italystrap/storage: ^1.0.0
Requires (Dev)
- cache/integration-tests: ^0.17.0
- codeception/module-asserts: ^1.0
- dealerdirect/phpcodesniffer-composer-installer: ^0.7.2
- infection/codeception-adapter: ^0.4.1
- infection/infection: ^0.26.6
- italystrap/debug: ^2.1
- italystrap/event: dev-master
- italystrap/storage-tests: dev-master
- lucatume/function-mocker-le: ^1.0
- lucatume/wp-browser: ^3.1
- phpbench/phpbench: ^1.2
- phpcompatibility/php-compatibility: ^9.3
- phpmetrics/phpmetrics: ^2.8
- phpspec/prophecy-phpunit: ^2.0
- rector/rector: ^0.15.17
- squizlabs/php_codesniffer: ^3.7
- vimeo/psalm: ^4.26
README
ItalyStrap Config Module - a simple and useful configuration package the OOP way
Table Of Contents
Installation
The best way to use this package is through Composer:
composer require italystrap/config
Documentation
Deprecation
List of all deprecated method that will be removed in the next major release (v3.x):
Config::push()
=>Config::set()
Config::add()
=>Config::set()
Config::remove()
=>Config::delete()
Config::all()
=>Config::toArray()
Config::toJson()
=> (string)\json_encode(new Config(), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);ConfigThemeMods::class
=> No replacement class is providedConfigThemeModTest::class
=> No replacement class is providedConfig_Factory::class
=>ConfigFactory::class
Config_Interface::class
=>ConfigInterface::class
- Move
\JsonSerializable
at theConfigInterface::class
level - The second parameter of
Config::__construct()
is deprecated and will be removed in the next major release, the first parameter is now the default value used for the configuration, to add additional configuration you can use theConfig::merge()
method like in the example below:
$defaultData = [ 'key' => 'value', ]; $additionalData = [ 'key' => 'new value', ]; $config = (new Config($defaultData))->merge($additionalData);
- The static method
ConfigFactory::make()
will be converted to a non-static, so you will need to instantiate the class to use it, like in the example below:
$config = new ConfigFactory(); $config->make($data);
Contributing
All feedback / bug reports / pull requests are welcome.
License
Copyright (c) 2019 Enea Overclokk, ItalyStrap
This code is licensed under the MIT.
Credits
Ideas for the Config::class from:
For the Notation Array Search:
For the traverse
method:
For some ideas: