php config manager
1.0.0
該庫允許開發人員以簡單,有條理和語法友好的方式使用基於文件的配置。該圖書館已建立了對開發人員的輕鬆和最小的努力。目前,它僅支持兩種類型,即JSON和PHP陣列。對於進一步的文件類型支持,很容易擴展基類。
composer require amanangira/php-config-manager
git clone https://github.com/amanangira/php-config-manager.git
use AmanAngiraConfigManagerPhpArrayManager;
$path = __DIR__ . '/config'; //Directory where the library expects the configuration files
$manager = new Manager($path); //Initializing object with the configurations path
use AmanAngiraConfigManagerJsonManager;
$path = __DIR__ . '/config'; //Directory where the library expects the configuration files
$manager = new Manager($path); //Initializing object with the configurations path
$value = $manager->get('foo.var'); //use file name only (without extension) followed by full stop to access child values
if( $value === Manager::NOT_FOUND_FLAG ) //library flag if a value is not defined
echo "Value not defined";
else
echo $value;