PHPackages                             stefangabos/zebra\_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. stefangabos/zebra\_form

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

stefangabos/zebra\_form
=======================

A jQuery augmented PHP library for creating and validating HTML forms

2.9.8(10y ago)961.2k48[15 issues](https://github.com/stefangabos/Zebra_Form/issues)[5 PRs](https://github.com/stefangabos/Zebra_Form/pulls)LGPL-3.0PHPPHP &gt;=5.3.0

Since Nov 4Pushed 3y ago19 watchersCompare

[ Source](https://github.com/stefangabos/Zebra_Form)[ Packagist](https://packagist.org/packages/stefangabos/zebra_form)[ Docs](http://stefangabos.ro/php-libraries/zebra-form/)[ RSS](/packages/stefangabos-zebra-form/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (4)DependenciesVersions (7)Used By (0)

Zebra\_Form
===========

[](#zebra_form)

#### A jQuery augmented PHP library for creating and validating HTML forms

[](#a-jquery-augmented-php-library-for-creating-and-validating-html-forms)

---

[Packagist](https://packagist.org/) stats

[![Latest Stable Version](https://camo.githubusercontent.com/d05370ad568823376006067a285d617e71d6c7ba585f525f859176d7b92c216c/68747470733a2f2f706f7365722e707567782e6f72672f73746566616e6761626f732f7a656272615f666f726d2f762f737461626c65)](https://packagist.org/packages/stefangabos/zebra_form) [![Total Downloads](https://camo.githubusercontent.com/1a0be6c40684126c448fadb2f4d5a24fd9b469004fc0a1d0af4979029f0d3eb0/68747470733a2f2f706f7365722e707567782e6f72672f73746566616e6761626f732f7a656272615f666f726d2f646f776e6c6f616473)](https://packagist.org/packages/stefangabos/zebra_form) [![Monthly Downloads](https://camo.githubusercontent.com/f1e401e5602b795762382890acd072de0e074de298e5cc5437651f4ee87385fe/68747470733a2f2f706f7365722e707567782e6f72672f73746566616e6761626f732f7a656272615f666f726d2f642f6d6f6e74686c79)](https://packagist.org/packages/stefangabos/zebra_form) [![Daily Downloads](https://camo.githubusercontent.com/957b3bbd0fa1040af713ace1e2012f15b3b57fc57406f2fbcc76e4ed9b861c32/68747470733a2f2f706f7365722e707567782e6f72672f73746566616e6761626f732f7a656272615f666f726d2f642f6461696c79)](https://packagist.org/packages/stefangabos/zebra_form) [![License](https://camo.githubusercontent.com/2aa71f462f08f674c9dd30d70451bbb7f3a78e7846a1b3dfa55644b24e3dfce7/68747470733a2f2f706f7365722e707567782e6f72672f73746566616e6761626f732f7a656272615f666f726d2f6c6963656e7365)](https://packagist.org/packages/stefangabos/zebra_form)

Zebra\_Form is a PHP library that greatly simplifies the process of creating and validating HTML forms. Its object-oriented structure promotes rapid HTML forms development and encourages developers to write clean and easily maintainable code and it frees the developers from the repetitive task of writing the code for validating forms by offering powerful built-in client-side and server-side validation.

Zebra\_Form has integrated [cross-site scripting](http://en.wikipedia.org/wiki/Cross-site_scripting) (XSS) prevention mechanism that automatically strips out potentially malicious code from the submitted data, and also features protection against [cross-site request forgery](http://en.wikipedia.org/wiki/Cross-site_request_forgery) (CSRF) attacks. It also prevents automated SPAM posts, out of the box and without relying on CAPTCHA by using [honeypots](http://haacked.com/archive/2007/09/11/honeypot-captcha.aspx).

Forms layout can be generated either automatically or manually – using templates. When generated automatically, the generated output validates as HTML 4.01 Strict, XHTML 1.0 Strict or HTML5, and has the same look &amp; feel across all major browsers like Firefox, Chrome, Opera, Safari and Internet Explorer 6+.

It provides all the controls you’d expect in an HTML form and, additionally, date/time pickers, CAPTCHA and advanced AJAX-like file upload controls – see the [documentation](http://stefangabos.ro/wp-content/docs/Zebra_Form/Generic/Zebra_Form_Control.html#methodset_rule) for validation rules that can be used out of the box.

The client-side validation is done using jQuery 1.5.2+

Zebra\_Form's code is heavily commented and generates no warnings/errors/notices when PHP’s error reporting level is set to E\_ALL.

Features
--------

[](#features)

- provides protection against cross-site scripting (XSS) and cross-site request forgery (CSRF) attacks out of the box it automatically prevents automated SPAM posts using the “honeypot” technique (CAPTCHAs can also be used for even stronger protection)
- provides both server-side and client-side validation (client-side validation is done using jQuery 1.5.2+) and has a lot of predefined rules that can be used out of the box; custom validation rules (including AJAX-based) can easily be added
- forms’ layout can be generated either automatically or manually using templates
- generated output validates as HTML 4.01 Strict, XHTML 1.0 Strict or HTML5
- works in all major browsers like Firefox, Chrome, Opera, Safari and Internet Explorer 6+
- code is heavily commented and generates no warnings/errors/notices when PHP’s error reporting level is set to E\_ALL
- has comprehensive documentation

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

[](#requirements)

PHP 5.0.2+ (preferably PHP 5.3.0 compiled with the “fileinfo” extension for more secure file uploads – read more at the change log for version 2.7.3)

jQuery 1.5.2+

How to use
----------

[](#how-to-use)

##### The HTML

[](#the-html)

```

>

        Zebra_Form Example

```

##### The PHP

[](#the-php)

```
// include the Zebra_Form class
require 'path/to/Zebra_Form.php';

// instantiate a Zebra_Form object
$form = new Zebra_Form('form');

// the label for the "email" field
$form->add('label', 'label_email', 'email', 'Email');

// add the "email" field
$obj = $form->add('text', 'email', '', array('autocomplete' => 'off'));

// set rules
$obj->set_rule(array(

    // error messages will be sent to a variable called "error", usable in custom templates
    'required'  =>  array('error', 'Email is required!'),
    'email'     =>  array('error', 'Email address seems to be invalid!'),

));

// "password"
$form->add('label', 'label_password', 'password', 'Password');

$obj = $form->add('password', 'password', '', array('autocomplete' => 'off'));

$obj->set_rule(array(

    'required'  => array('error', 'Password is required!'),
    'length'    => array(6, 10, 'error', 'The password must have between 6 and 10 characters'),

));

// "remember me"
$form->add('checkbox', 'remember_me', 'yes');

$form->add('label', 'label_remember_me_yes', 'remember_me_yes', 'Remember me');

// "submit"
$form->add('submit', 'btnsubmit', 'Submit');

// validate the form
if ($form->validate()) {

    // do stuff here

}

// auto generate output, labels above form elements
$form->render();
```

For demos and more information visit the **[project's homepage](http://stefangabos.ro/php-libraries/zebra-form/)**

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 94.1% 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 ~186 days

Total

4

Last Release

3695d ago

PHP version history (2 changes)2.9.5PHP &gt;=5.0.2

2.9.8PHP &gt;=5.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1089e48cafe9a5737b8512d9fddff8596b9ef102276f25b6361bc6781d108aa?d=identicon)[stefangabos](/maintainers/stefangabos)

---

Top Contributors

[![stefangabos](https://avatars.githubusercontent.com/u/741165?v=4)](https://github.com/stefangabos "stefangabos (143 commits)")[![Scorpshn](https://avatars.githubusercontent.com/u/5324132?v=4)](https://github.com/Scorpshn "Scorpshn (4 commits)")[![maximkou](https://avatars.githubusercontent.com/u/2118695?v=4)](https://github.com/maximkou "maximkou (1 commits)")[![gilbsgilbs](https://avatars.githubusercontent.com/u/3407667?v=4)](https://github.com/gilbsgilbs "gilbsgilbs (1 commits)")[![tudor-sv](https://avatars.githubusercontent.com/u/6899448?v=4)](https://github.com/tudor-sv "tudor-sv (1 commits)")[![mkoosej](https://avatars.githubusercontent.com/u/4195529?v=4)](https://github.com/mkoosej "mkoosej (1 commits)")[![khayyam90](https://avatars.githubusercontent.com/u/824766?v=4)](https://github.com/khayyam90 "khayyam90 (1 commits)")

---

Tags

csrf-protectionform-validationhtml-formphpphp-formxssvalidationvalidatexssformcsrfHoneypotjquery validationserver-side validationclient side validation

### Embed Badge

![Health badge](/badges/stefangabos-zebra-form/health.svg)

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

###  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.

53013.5M485](/packages/nette-forms)[proengsoft/laravel-jsvalidation

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

1.1k2.3M50](/packages/proengsoft-laravel-jsvalidation)[wixel/gump

A fast, extensible &amp; stand-alone PHP input validation class that allows you to validate any data.

1.2k1.4M31](/packages/wixel-gump)[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

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

Constraint class for international zipcode validation

772.4M](/packages/barbieswimcrew-zip-code-validator)[laravel-lang/attributes

Translation of form element names

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

PHPackages © 2026

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