devinci-it/quick-form
Composer 安装命令:
composer require devinci-it/quick-form
包简介
Quick-Form is a lightweight PHP library designed to streamline the creation of HTML forms in your PHP applications. It provides a simple and intuitive interface for generating HTML forms with ease.
README 文档
README
The Devinci\QuickForm library provides a convenient way to generate HTML forms dynamically in PHP applications. With this library, developers can easily create and customize forms with various input types, set form attributes, and handle form rendering seamlessly.
Features
- FormBuilder Class: The core component of the library, allowing for the programmatic creation of HTML forms.
- Support for Multiple Input Types: Text inputs, integer inputs, text areas, date inputs, radio buttons, and checkboxes are all supported.
- Form Attribute Management: Easily set form attributes such as method, action, class, and id.
- Input Grouping: Group input fields together for better organization and presentation within the form.
- Submit and Clear Buttons: Set submit and clear buttons with customizable attributes.
- Customization: Flexibility to customize form elements, attributes, and buttons according to requirements.
Installation
You can install the Devinci\QuickForm library via Composer:
composer require devinci-it/quick-form
Alternatively, you can include the necessary files manually in your project.
Usage
-
Instantiate FormBuilder: Create an instance of the
FormBuilderclass by providing the form action and, optionally, the form submission method and a custom HTML renderer.$formBuilder = new FormBuilder('/submit-form', 'POST');
-
Set Form Attributes: Optionally, set attributes for the form tag using the
setFormAttributesmethod.$formBuilder->setFormAttributes([ 'class' => 'my-form', 'id' => 'my-form-id' ]);
-
Add Input Fields: Add input fields to the form using methods like
addTextInput,addIntegerInput,addTextArea, etc.$formBuilder->addTextInput('username', 'Enter your username', ['class' => 'form-control']); $formBuilder->addIntegerInput('age', 'Enter your age');
-
Group Inputs: Group input fields together using the
setInputGroupmethod if needed.$formBuilder->setInputGroup('personal_info', ['username', 'age']);
-
Set Submit and Clear Buttons: Set the submit button and clear button using the
setSubmitButtonandsetClearButtonmethods respectively.$formBuilder->setSubmitButton('submit', 'Submit Form', ['class' => 'btn btn-primary']); $formBuilder->setClearButton('clear', 'Clear Form', ['class' => 'btn btn-secondary']);
-
Render the Form: Render the form HTML using the
rendermethod.echo $formBuilder->render();
-
Integration with Web Applications: Integrate the generated forms seamlessly into your web applications by embedding them within HTML pages or templates.
-
Customization: Customize the appearance and behavior of forms by modifying CSS styles, JavaScript interactions, and form processing logic as per your application's requirements.
Examples
The Devinci QuickForm library can be used for various use cases including:
- User Registration Forms
- Data Entry Forms
- Contact Forms
- Survey Forms
Contribution
Contributions to the Devinci QuickForm library are welcome! Feel free to submit bug reports, feature requests, or pull requests via GitHub.
License
This library is licensed under the MIT License. See the LICENSE file for details.
devinci-it/quick-form 适用场景与选型建议
devinci-it/quick-form 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 devinci-it/quick-form 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 devinci-it/quick-form 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-12