enjoys/forms

forms 5.x 开发版


README

Mutation testing badge Code Coverage Scrutinizer Code Quality php 8.0

初始化表单

use Enjoys\Forms\Form;
$form = new Form();
//or
$form = new Form('get', 'action.php');

添加的元素

use Enjoys\Forms\Form;
use Enjoys\Forms\Elements;

$form = new Form();
$form->text('name', 'label');

//or
$textElement = new Elements\Text('name', 'label');
$form->addElement($textElement);

元素列表

  • 按钮
  • 验证码(需要实现 CaptchaInterface 接口)
  • 复选框
  • 颜色
  • 数据列表
  • 日期
  • 日期时间
  • 本地日期时间
  • 电子邮件
  • 文件
  • 分组
  • 标题
  • 隐藏
  • HTML
  • 图片
  • 月份
  • 数字
  • 密码
  • 单选按钮
  • 范围
  • 重置
  • 搜索
  • 选择
  • 提交
  • 电话
  • 文本
  • 文本区域
  • 时间
  • 网址

运行内置服务器以查看示例

port=$(shuf -i 2048-65000 -n 1);
php -S localhost:"${port}" -t ./example .route