PHPackages                             pear/html\_quickform2 - 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. pear/html\_quickform2

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

pear/html\_quickform2
=====================

Provides methods to create, validate and render HTML forms in PHP.

v2.4.0(1y ago)24498.9k↑24.3%181BSD-3-ClausePHPPHP &gt;=7.1CI passing

Since Feb 17Pushed 1y ago13 watchersCompare

[ Source](https://github.com/pear/HTML_QuickForm2)[ Packagist](https://packagist.org/packages/pear/html_quickform2)[ Docs](https://pear.php.net/package/HTML_QuickForm2/)[ RSS](/packages/pear-html-quickform2/feed)WikiDiscussions trunk Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (14)Used By (1)

HTML\_QuickForm2
================

[](#html_quickform2)

[![Build Status](https://github.com/pear/HTML_QuickForm2/actions/workflows/continuous-integration.yml/badge.svg?branch=trunk)](https://github.com/pear/HTML_QuickForm2/actions/workflows/continuous-integration.yml)[![Static Analysis](https://github.com/pear/HTML_QuickForm2/actions/workflows/static-analysis.yml/badge.svg?branch=trunk)](https://github.com/pear/HTML_QuickForm2/actions/workflows/static-analysis.yml)

This is a repository for [PEAR HTML\_QuickForm2](https://pear.php.net/package/HTML_QuickForm2/) package that has been migrated from [PEAR SVN](https://svn.php.net/repository/pear/packages/HTML_QuickForm2).

HTML\_QuickForm2 provides methods to create, validate and render HTML forms. It is a PHP5 rewrite of [PEAR HTML\_QuickForm](https://pear.php.net/package/HTML_QuickForm/)and related packages.

Features:

- Supports all form elements defined in HTML4, provides several custom elements. Support for HTML5 form elements is planned.
- Server-side and client-side validation, several common rules provided. Validation rules can be combined with 'and' and 'or' for complex validation scenarios. Client-side validation can be run on changing the form field and on submitting the form.
- Client-side validation and Javascript-backed elements use a small self-contained JS library, there is no dependency on JS frameworks.
- Multipage forms (tabbed forms and wizards) are possible.
- Pluggable elements, rules, renderers and renderer plugins.

Please report issues via the [PEAR bug tracker](https://pear.php.net/bugs/search.php?cmd=display&package_name%5B%5D=HTML_QuickForm2) or [Github issues](https://github.com/pear/HTML_QuickForm2/issues).

Pull requests are welcome.

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

[](#installation)

The package may be installed either with PEAR

```
$ pear install HTML_QuickForm2

```

or with composer

```
$ composer require pear/html_quickform2

```

Since release 2.1 composer installation relies completely on autoloading and does not contain `require_once` calls or use `include-path` option.

Basic usage
-----------

[](#basic-usage)

```
require_once 'HTML/QuickForm2.php'; // Only when installed with PEAR

$form = new HTML_QuickForm2('tutorial');

// Set defaults for the form elements
$form->addDataSource(new HTML_QuickForm2_DataSource_Array([
    'name' => 'Joe User'
]));

// Add some elements to the form
$fieldset = $form->addElement('fieldset')->setLabel('QuickForm2 tutorial example');
$name = $fieldset->addElement('text', 'name', ['size' => 50, 'maxlength' => 255])
                 ->setLabel('Enter your name:');
$fieldset->addElement('submit', null, ['value' => 'Send!']);

// Define filters and validation rules
$name->addFilter('trim');
$name->addRule('required', 'Please enter your name');

// Try to validate a form
if ($form->validate()) {
    echo 'Hello, ' . htmlspecialchars($name->getValue()) . '!';
    exit;
}

// Output the form
echo $form;
```

Additional examples are in the docs/examples directory.

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

[](#documentation)

...is available on PEAR website

- [Tutorial](http://pear.php.net/manual/en/package.html.html-quickform2.tutorial.php)
- [Migration from HTML\_QuickForm](http://pear.php.net/manual/en/package.html.html-quickform2.qf-migration.php) and [HTML\_QuickForm\_Controller](http://pear.php.net/manual/en/package.html.html-quickform2.controller-migration.php)
- [Form elements](http://pear.php.net/manual/en/package.html.html-quickform2.elements.php) overview
- [Elements' values and validation](http://pear.php.net/manual/en/package.html.html-quickform2.values.php)
- [Form output customization and Javascript support](http://pear.php.net/manual/en/package.html.html-quickform2.output.php)
- [Multipage forms](http://pear.php.net/manual/en/package.html.html-quickform2.multipage.php)

[Generated API documentation](http://pear.php.net/package/HTML_QuickForm2/docs/latest/) for the current release is also there.

Testing, Packaging and Installing (Pear)
----------------------------------------

[](#testing-packaging-and-installing-pear)

To test, run

```
$ phpunit tests/

```

after installing dependencies with composer. You can also test the installed package with

```
$ phpunit [PEAR tests dir]/HTML_QuickForm2

```

Since PEAR package needs its `require_once` statements re-enabled, please run the helper file before packaging and installing

```
$ php pear-package-helper.php

```

Then to build, simply

```
$ pear package .pear-package/package.xml

```

To install from scratch

```
$ pear install .pear-package/package.xml

```

To upgrade

```
$ pear upgrade -f .pear-package/package.xml

```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance46

Moderate activity, may be stable

Popularity49

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 84.8% 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 ~394 days

Recently: every ~347 days

Total

11

Last Release

400d ago

PHP version history (3 changes)v2.2.0PHP &gt;=5.4.0

v2.3.0PHP &gt;=5.6.0

v2.4.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b43550745afa89d33e4b93f8535fc31c93ac0a712d264c13cb8f8c62d9198c1?d=identicon)[sad-spirit](/maintainers/sad-spirit)

---

Top Contributors

[![sad-spirit](https://avatars.githubusercontent.com/u/4820288?v=4)](https://github.com/sad-spirit "sad-spirit (369 commits)")[![golgote](https://avatars.githubusercontent.com/u/12360?v=4)](https://github.com/golgote "golgote (61 commits)")[![till](https://avatars.githubusercontent.com/u/27003?v=4)](https://github.com/till "till (3 commits)")[![CloCkWeRX](https://avatars.githubusercontent.com/u/365751?v=4)](https://github.com/CloCkWeRX "CloCkWeRX (2 commits)")

---

Tags

formform-validationjavascriptphpquickformvalidationjavascriptFormswizardPEARquickform

### Embed Badge

![Health badge](/badges/pear-html-quickform2/health.svg)

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

###  Alternatives

[nette/forms

📝 Nette Forms: generating, validating and processing secure forms in PHP. Handy API, fully customizable, server &amp; client side validation and mature design.

54013.2M450](/packages/nette-forms)[proengsoft/laravel-jsvalidation

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

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[karser/karser-recaptcha3-bundle

Google ReCAPTCHA v3 for Symfony

1862.4M7](/packages/karser-karser-recaptcha3-bundle)[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)[sheadawson/silverstripe-zenvalidator

Faster, easier client and server-side form validation for SilverStripe

5778.4k2](/packages/sheadawson-silverstripe-zenvalidator)

PHPackages © 2026

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