tasmaniski/zf2-params-helper
最新稳定版本:3.0.2
Composer 安装命令:
composer require tasmaniski/zf2-params-helper
包简介
View Helper for reading data from $_GET, $_POST and Routes in view
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 Params Helper
View Helper will read params from $_GET, $_POST and Routes in Laminas MVC project.
Install
Add in you composer.json file:
{
"require": {
"tasmaniski/laminas-params-helper": "^3.0"
}
}
After running: composer update
You need to register new module. Add in file config/application.config.php:
'modules' => array(
'...',
'ParamsHelper'
),
Use
We can use it in any view file (including layout) as key name params(). View Helper params() served to read variables from $_POST, $_GET or from Routes.
//will read all variables from $_POST $this->params()->fromPost(); //will read all variables from Routes $this->params()->fromRoute(); //will read all variables from $_GET $this->params()->fromQuery();
Or you can get one variable by name. Second param is optional and it's default value if helper can not find the key.
//will read var with name 'id' and if id is null it will return 1 as default $this->params()->fromRoute('id', 1);
统计信息
- 总下载量: 7.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2015-11-12