gsouf/uform
最新稳定版本:0.2.0
Composer 安装命令:
composer require gsouf/uform
包简介
Full featured form library
README 文档
README
UForm is a form validation/filtering/rendering library for PHP.
Usage
Quick start
use UForm\Builder; $form = Builder::init("action", "POST") ->columnGroup() ->column(3, 12) ->text("firstname", "Firstname")->required()->stringLength(2, 20) ->text("lastname", "Lastname")->required()->stringLength(2, 20) ->close() ->column(3, 12) ->panel('Login Information') ->text("login", "Login")->required()->stringLength(2, 20) ->password("password", "Password")->required()->stringLength(2, 20) ->close() ->close() ->close() ->getForm(); //If it's a post request we validate the form with the post data if ($_SERVER['REQUEST_METHOD'] == "POST") { $formContext = $form->validate($form->getInputFromGlobals()); if ($formContext->isValid()) { $filteredData = $formContext->getData(); // Do some logic with data // ... } } else { // Or else we just generate a context with empty values $formContext = $form->generateContext([]); } // We want to render some html for bootstrap 3 $formRenderer = new Bootstrap3Render(); $html = $formRenderer->render($formContext); echo $html;
The above example will result in:
Full documentation
The full documentation will available at gsouf.github.io/UForm once the project will be considered as stable
统计信息
- 总下载量: 160
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-19