arastta/form
最新稳定版本:1.1.0
Composer 安装命令:
composer require arastta/form
包简介
Arastta Form Component
README 文档
README
Form component provides rapid development of forms through an object-oriented PHP structure.
Elements
It can create a variety of elements including Textboxes, Textareas, Checkboxes, Selectboxes, Date inputs, Color inputs and so on. The current version has more than 34 elements. Additionaly, it has support for 13 HTML 5 form elements: Phone, Search, Url, Email, DateTime, Date, Month, Week, Time, DateTimeLocal, Number, Range, and Color. Each of these fallback to textboxes in the event that the HTML5 input type isn't supported in the user's web browser.
Validation
For browsers that support HTML5 it will do simple client side data validation before the form is submitted (for example, required field). But most of validations are server-sided based (look at Validation classes inside Validation folder). To do the server side validation you must call the method isValid() when the form is submitted, redirecting the page if it returns false. In this case, when the form is show again, it will be automatically filled with data recovered from the user session, and validation errors will be presented in red.
Views
With the Views functionality it is possible to arrange form elements in horizontal, vertical, inline or search layouts.
Usage
use Arastta\Component\Form\Form; use Arastta\Component\Form\Element; $options = array("Option #1", "Option #2", "Option #3"); $form = new Form("my-form"); $form->addElement(new Element\Hidden("form", "form-elements")); $form->addElement(new Element\HTML('<legend>Standard</legend>')); $form->addElement(new Element\Textbox("Textbox:", "Textbox")); $form->addElement(new Element\Password("Password:", "Password")); $form->addElement(new Element\File("File:", "File")); $form->addElement(new Element\Textarea("Textarea:", "Textarea")); $form->addElement(new Element\Select("Select:", "Select", $options)); $form->addElement(new Element\Radio("Radio Buttons:", "RadioButtons", $options)); $form->addElement(new Element\Checkbox("Checkboxes:", "Checkboxes", $options)); $form->addElement(new Element\HTML('<legend>HTML5</legend>')); $form->addElement(new Element\Phone("Phone:", "Phone")); $form->addElement(new Element\Search("Search:", "Search")); $form->addElement(new Element\Url("Url:", "Url")); $form->addElement(new Element\Email("Email:", "Email")); $form->addElement(new Element\Date("Date:", "Date")); $form->addElement(new Element\DateTime("DateTime:", "DateTime")); $form->addElement(new Element\DateTimeLocal("DateTime-Local:", "DateTimeLocal")); $form->addElement(new Element\Month("Month:", "Month")); $form->addElement(new Element\Week("Week:", "Week")); $form->addElement(new Element\Time("Time:", "Time")); $form->addElement(new Element\Number("Number:", "Number")); $form->addElement(new Element\Range("Range:", "Range")); $form->addElement(new Element\Color("Color:", "Color")); $form->addElement(new Element\HTML('<legend>jQuery UI</legend>')); $form->addElement(new Element\JQueryUIDate("Date:", "JQueryUIDate")); $form->addElement(new Element\Checksort("Checksort:", "Checksort", $options)); $form->addElement(new Element\Sort("Sort:", "Sort", $options)); $form->addElement(new Element\HTML('<legend>Custom/Other</legend>')); $form->addElement(new Element\State("State:", "State")); $form->addElement(new Element\Country("Country:", "Country")); $form->addElement(new Element\YesNo("Yes/No:", "YesNo")); $form->addElement(new Element\Captcha("Captcha:")); $form->addElement(new Element\Button); $form->addElement(new Element\Button("Cancel", "button", array( "onclick" => "history.go(-1);" ))); $form->render();
Installation via Composer
Add "arastta/form": "~1.0" to the require block in your composer.json and then run composer install.
{
"require": {
"arastta/form": "~1.0"
}
}
Alternatively, you can simply run the following from the command line:
composer require arastta/form "~1.0"
License
This project is based on PFBC (PHP Form Builder Class) and released under the GPLv3 license.
arastta/form 适用场景与选型建议
arastta/form 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.46k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2015 年 11 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「form」 「builder」 「arastta」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 arastta/form 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arastta/form 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 arastta/form 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
A Sphinx Query Builder extension for the Laravel Database package
Anax Database Active Record module for model classes.
A Laravel Filament Forms slug field.
A simple package to create tables in Discord messages.
A jQuery augmented PHP library for creating and validating HTML forms
统计信息
- 总下载量: 1.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2015-11-21