rcm/config
最新稳定版本:1.2.3
Composer 安装命令:
composer require rcm/config
包简介
Extend the functionality of ZF2 config as well as allow config sources to be changed
README 文档
README
Module title:
RCM Config
Module description:
Extend the functionality of ZF2 config as well as allow config sources to be changed
- Models my be written and injected to pull from any source by category
- ZF2 ConfigModel and Doctine ConfigModel is available by default
- Allows for config sources to be changed without impact to existing code
- Allows for a standard for storing config values
Config Example:
<?php // Example of a config array as might be defined in ZF2 config 'Reliv\RcmConfig' => [ 'myCategory' => [ '_DEFAULT' => [ 'myPropertyName1' => 'my value', 'myPropertyName2' => ['my value1', 'my value2'], ], 'myContext' => [ 'myPropertyName1' => 'my value over-ride', ] ] ], // Example of defining a model for a category 'Reliv\RcmConfig\Models' => [ 'myCategory' => \Reliv\RcmConfig\Model\ConfigModel::class, ],
Usage Example
<?php /** Using /Zend\ServiceManager/ServiceManager as $serviceLocator */ $configService = $serviceLocator->get(\Reliv\RcmConfig\Service\ConfigService::class); $value = $configService->getValue( 'myCategory', 'myContext', 'myPropertyName1' ); /** Outputs: 'my value over-ride' */ var_dump($value); $value = $configService->getValue( 'myCategory', 'myContext', 'myPropertyName2' ); /** Outputs: ['my value1', 'my value2'] */ var_dump($value); /** Other Methods */ var_dump( 'getList', $cs->getList('myCategory'), 'getAll', $cs->getAll('myCategory', 'myContext'), 'getDefault', $cs->getDefault('myCategory'), 'getListValue', $cs->getListValue('myCategory', 'myPropertyName1'), 'getPrimary', $cs->getPrimary('myCategory', 'myContext') );
Project author:
James Jervis
https://github.com/reliv/rcm-config
Copyright (c) 2015, Reliv' International
统计信息
- 总下载量: 3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-10-16