pear/html_quickform2
Composer 安装命令:
composer require pear/html_quickform2
包简介
Provides methods to create, validate and render HTML forms in PHP.
README 文档
README
This is a repository for PEAR HTML_QuickForm2 package that has been migrated from PEAR SVN.
HTML_QuickForm2 provides methods to create, validate and render HTML forms. It is a PHP5 rewrite of PEAR HTML_QuickForm and related packages.
Features:
- Supports all form elements defined in HTML4, provides several custom elements. Support for HTML5 form elements is planned.
- Server-side and client-side validation, several common rules provided. Validation rules can be combined with 'and' and 'or' for complex validation scenarios. Client-side validation can be run on changing the form field and on submitting the form.
- Client-side validation and Javascript-backed elements use a small self-contained JS library, there is no dependency on JS frameworks.
- Multipage forms (tabbed forms and wizards) are possible.
- Pluggable elements, rules, renderers and renderer plugins.
Please report issues via the PEAR bug tracker or Github issues.
Pull requests are welcome.
Installation
The package may be installed either with PEAR
$ pear install HTML_QuickForm2
or with composer
$ composer require pear/html_quickform2
Since release 2.1 composer installation relies completely on autoloading and does not contain require_once calls or
use include-path option.
Basic usage
require_once 'HTML/QuickForm2.php'; // Only when installed with PEAR $form = new HTML_QuickForm2('tutorial'); // Set defaults for the form elements $form->addDataSource(new HTML_QuickForm2_DataSource_Array([ 'name' => 'Joe User' ])); // Add some elements to the form $fieldset = $form->addElement('fieldset')->setLabel('QuickForm2 tutorial example'); $name = $fieldset->addElement('text', 'name', ['size' => 50, 'maxlength' => 255]) ->setLabel('Enter your name:'); $fieldset->addElement('submit', null, ['value' => 'Send!']); // Define filters and validation rules $name->addFilter('trim'); $name->addRule('required', 'Please enter your name'); // Try to validate a form if ($form->validate()) { echo '<h1>Hello, ' . htmlspecialchars($name->getValue()) . '!</h1>'; exit; } // Output the form echo $form;
Additional examples are in the docs/examples directory.
Documentation
...is available on PEAR website
- Tutorial
- Migration from HTML_QuickForm and HTML_QuickForm_Controller
- Form elements overview
- Elements' values and validation
- Form output customization and Javascript support
- Multipage forms
Generated API documentation for the current release is also there.
Testing, Packaging and Installing (Pear)
To test, run
$ phpunit tests/
after installing dependencies with composer. You can also test the installed package with
$ phpunit [PEAR tests dir]/HTML_QuickForm2
Since PEAR package needs its require_once statements re-enabled, please run the helper file before packaging and
installing
$ php pear-package-helper.php
Then to build, simply
$ pear package .pear-package/package.xml
To install from scratch
$ pear install .pear-package/package.xml
To upgrade
$ pear upgrade -f .pear-package/package.xml
pear/html_quickform2 适用场景与选型建议
pear/html_quickform2 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 524.41k 次下载、GitHub Stars 达 23, 最近一次更新时间为 2015 年 01 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「PEAR」 「javascript」 「wizard」 「validation」 「Forms」 「quickform」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pear/html_quickform2 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pear/html_quickform2 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pear/html_quickform2 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Generates a Blade directive exporting all of your named Laravel routes. Also provides a nice route() helper function in JavaScript.
Provides methods to create, validate and render HTML forms in PHP.
Caching and compression for Twig assets (JavaScript and CSS).
A pretty nice way to expose your translation messages to your JavaScript.
Site generator / tree model duplicator used to generate mini-website or duplicate tree model
This is the Mysqli MDB2 driver.
统计信息
- 总下载量: 524.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 24
- 点击次数: 22
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-01-14