jdz/form 问题修复 & 功能扩展

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

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

jdz/form

Composer 安装命令:

composer require jdz/form

包简介

Framework-agnostic form building, filtering and validation library

README 文档

README

A framework-agnostic PHP library for building, filtering and validating forms.

Features

  • 🧱 Rich field set: text, email, url, tel, password, search, number, date/datetime/time/month/week/year, color, file, hidden, checkbox, radio, select, textarea
  • 🧹 Filters: normalize input before validation (string, int, decimal, bool, array, email, url, tel, date, time, color, or a custom callback)
  • Rules: declarative validation with typed error handling
  • 🗂️ Structure: group fields into fieldsets and form rows (including boolean, checkboxes, input-group and hidden rows)
  • 🔒 CSRF & captcha: opt-in per form
  • 🔗 Fluent API: chainable configuration, framework-agnostic rendering via toData()
  • Well tested: 285 tests

Installation

composer require jdz/form

Requirements

  • PHP 8.2 or higher

Quick start

use JDZ\Form\Form;
use JDZ\Form\FormData;

$form = new Form('contact');

$fieldset = $form->makeFormFieldset('main');
// add fields / rows to the fieldset, each with its filters and rules

// bind submitted values and run the lifecycle
$form->init(new FormData($_POST));

if ($form->submit()) {
    // $form->filter();  normalize
    // $form->validate(); apply rules
    if (!$form->getErrors()) {
        // persist $form->getData()
    }
}

Forms expose their state through toData(), so rendering is left entirely to the consuming application (Twig, plain PHP, an admin UI layer, etc.).

Testing

composer test

License

MIT — see LICENSE.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固