fuelphp/fieldset 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fuelphp/fieldset

Composer 安装命令:

composer require fuelphp/fieldset

包简介

Form generation and building

README 文档

README

Build Status Code Coverage Quality Score HHVM Status

Form generation and building.

This package will replace the default Fieldset class provided by the FuelPHP v1.x core by the FuelPHP v2.0 fieldset package.

Install

Via Composer

$ composer require fuelphp/fieldset

Once the package reaches a suitable milestone a tagged release will be created.

Getting started

Forms are created by first creating a container object, a Form or a Fieldset. You can then add Inputs to these containers.

<?php

use Fuel\Fieldset\Form;
use Fuel\Fieldset\Input;

$form = new Form;

$form[] = new Input\Text('name');
$form[] = new Input\Submit('submit', [], 'GO!');

//This will repopulate the form with any submitted data
$form->repopulate();

//This will repopulate the form with the given data, the flag indicates wether to call `repopulate()` after or not
$form->populate($myData, true);

InputElement types

The current InputElement classes exist.

  • Button
  • Checkbox
  • CheckboxGroup
  • Email
  • File
  • Hidden
  • Optgroup
  • Option
  • Password
  • Radio
  • RadioGroup
  • Reset
  • Select
  • Submit
  • Text
  • Textarea

Grouped check boxes and radio buttons now have their own logic for repopulation and naming when used in groups, hence the ChecboxGroup and RadioGroup classes. Select elements are comprised of Options and Optgroups. For more info on check box/radio groups and selects please see here.

Showing the form

Unlike v1 fieldsets a totally separate class is used to create the html for the form. Whilst each InputElement knows how to display itself in the most basic form the use of a Renderer allows for more complex behaviour to be achieved. This can include things such as generating the form in a table or as a list. By default BasicRender will render the form in a table, much the same as the v1 fieldsets did. In the future other basic renderers might be added to the package to support things like list based forms out of the box. Pull/merge requests are always welcome.

The render classes are all used in the same basic way:

<?php

use Fuel\Fieldset\Render\BasicRender;

$engine = new BasicRender();

$formHtml = $engine->render($form);

It is easily possible to create your own renderer if the default one does not suit your needs. For an example take a look at the BasicRender code and additionally here. If you do make your own renderer for a UI kit or css framework then please consider submitting a pull request!

Included Renderers

Fieldset comes with a couple of basic renderes, a generic one that does not add any formatting or css and a Bootstrap3 based renderer that will build forms that are compatible with the Bootstrap CSS framework.

3rd party renderers

fuelphp/fieldset 适用场景与选型建议

fuelphp/fieldset 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.32k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2013 年 01 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「form」 「fieldset」 「form builder」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 fuelphp/fieldset 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 fuelphp/fieldset 我们能提供哪些服务?
定制开发 / 二次开发

基于 fuelphp/fieldset 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 5.32k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 17
  • 依赖项目数: 5
  • 推荐数: 1

GitHub 信息

  • Stars: 8
  • Watchers: 7
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-01-30