tasmaniski/zf2-config-helper
最新稳定版本:v3.0.2
Composer 安装命令:
composer require tasmaniski/zf2-config-helper
包简介
Provide Controller plugin and View helper for reading a config.
README 文档
README
IMPORTANT NOTE: If you find this package useful, please click on a star button and let me know, so I will gladly continue with the updates.
Laminas MVC - Config Helper
Simple and small lib for reading a config array in all Controllers and all Views files.
Instalation
Add in your composer.json file:
{
"require": {
"tasmaniski/laminas-config-helper": "^3.0"
}
}
After running: composer update
You need to register new module. Add in file config/application.config.php:
'modules' => array(
'...',
'ConfigHelper'
),
Use
You can use it in any of your controllers or view files (including layout.phtml). First you have to add key in any of your config files (config/autoload/*) eg. "key_from_config"
//read specific key registred in your config file.
$keyFromConfig = $this->configHelp('key_from_config');
// or in new version of PHP
$keyFromConfig = $this->configHelp()->key_from_config;
$keyFromConfig = $this->configHelp()['key_from_config']; // only for 5.4+
// this will read whole config
$config = $this->configHelp(); // return config object Laminas\Config\Config
echo $config->key_from_config;
统计信息
- 总下载量: 288
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-29