PHPackages                             jenwachter/html-form - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. jenwachter/html-form

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

jenwachter/html-form
====================

A PHP library designed to make creating, validating, and maintaining forms easier.

v0.8.2(6y ago)611.3k2[5 issues](https://github.com/jenwachter/html-form/issues)MITPHPPHP &gt;=5.3.2

Since May 9Pushed 6y ago3 watchersCompare

[ Source](https://github.com/jenwachter/html-form)[ Packagist](https://packagist.org/packages/jenwachter/html-form)[ Docs](http://github.com/jenwachter/html-form)[ RSS](/packages/jenwachter-html-form/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (17)Used By (0)

HTML Form
=========

[](#html-form)

Hate writing and validating HTML forms? Me too. The HTML Form library was designed to make creating, validating, and maintaining forms easier.

Requirements
------------

[](#requirements)

1. PHP &gt;= 5.3.2
2. Sessions enabled (if you want the form fields to repopulate)

Installation
------------

[](#installation)

Via Composer:

```
{
    "require": {
        "jenwachter/html-form": "0.3.*"
    }
}
```

Documentation
-------------

[](#documentation)

See below for basic usage or [see the wiki](https://github.com/jenwachter/html-form/wiki).

Basic Usage
-----------

[](#basic-usage)

```
// Create the form
$form = new \HtmlForm\Form();

// Add a fieldset
$fieldset = $form->addFieldset("Contact info");

// Add some form fields
$fieldset->addTextbox("name", "Your name", array("required" => true))
	->addEmail("email", "Your email", array("required" => true))
	->addNumber("age", "Your age")
	->addSelect("gender", "Your gender", array("male", "female"));

$form->addSubmit("submit", "Submit");

// Render the form
$form->display();

// Validate the form
if (isset($_POST["submit"]) && $form->isValid()) {
    // continue processing the form as you see fit
}
```

Changelog
---------

[](#changelog)

- 0.8

    - Added server-side validation for maxlength attribute
- 0.7

    - Moved location of help text to after label for accessibility
- 0.6.2

    - Added htmlspecialchars method
- 0.6.1

    - Bugfix
- 0.6

    - Added striptags sanitizer
- 0.5

    - Moved validation functions into element classes.
    - Added sanitizer class
- 0.4

    - Removed `$_GET` support
    - Improved unit tests
- 0.3.3

    - Removed label from honeypot
- 0.3.2

    - Removed rendering of global `beforeElement` and `afterElement` content before and after bits of HTML.
- 0.3.1

    - Bug fix
- 0.3

    - Added a flag that allows option form fields to use the numeric keys of the options array as the option field's value. [Issue #13](https://github.com/jenwachter/html-form/issues/13)
- 0.2

    - Method name changes in HtmlForm\\Form:
        - render() is now display()
        - compileForm() is now render()
- 0.1

    - Initial release

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance3

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~180 days

Recently: every ~290 days

Total

15

Last Release

2225d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/11e1b915549459b87bab747538857fb810a047407ad1a0eeee929e23908d5490?d=identicon)[jenwachter](/maintainers/jenwachter)

---

Top Contributors

[![jenwachter](https://avatars.githubusercontent.com/u/1202305?v=4)](https://github.com/jenwachter "jenwachter (192 commits)")

---

Tags

validationform

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jenwachter-html-form/health.svg)

```
[![Health](https://phpackages.com/badges/jenwachter-html-form/health.svg)](https://phpackages.com/packages/jenwachter-html-form)
```

###  Alternatives

[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[siriusphp/validation

Data validation library. Validate arrays, array objects, domain models etc using a simple API. Easily add your own validators on top of the already dozens built-in validation rules

181743.3k13](/packages/siriusphp-validation)[barbieswimcrew/zip-code-validator

Constraint class for international zipcode validation

772.3M](/packages/barbieswimcrew-zip-code-validator)[fp/jsformvalidator-bundle

Javascript validation for sf\[2|3|4\] forms.

132418.8k1](/packages/fp-jsformvalidator-bundle)[apy/jsfv-bundle

Symfony2 Javascript Form Validation Bundle with localisation support

92770.5k](/packages/apy-jsfv-bundle)[laravel-lang/attributes

Translation of form element names

273.8M11](/packages/laravel-lang-attributes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
