PHPackages                             form-validate/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. form-validate/form

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

form-validate/form
==================

Basic form validation in PHP Edit

461PHP

Since May 17Pushed 9y ago1 watchersCompare

[ Source](https://github.com/webfashionist/FormValidate)[ Packagist](https://packagist.org/packages/form-validate/form)[ RSS](/packages/form-validate-form/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

FormValidate
============

[](#formvalidate)

Basic form validation in PHP

Usage
-----

[](#usage)

1. Include the class located in `FormValidate/Form.class.php` wherever you need the PHP form validator.
2. Create the rules array for your existing form:

```
$rules = [];
$rules["input_name"] = [
    "required" => true,
    "minlength" => 3,
    "maxlength" => 100,
    "alphabetical" => true,
    "label" => "name",
    ];
```

Existing rule keys are:

- `required` *boolean* - If set to true, the field must not be empty when submitting the form
- `empty` *boolean* - If set to true, the field must be empty when submitting the form
- `minlength` *integer* - Sets a minimal length for the field value
- `maxlength` *integer* - Sets a maximal length for the field value
- `alphabetical` *boolean* - If set to true, the field must only include alpabetical letters (a-z or A-Z), have a minimal length of 2 and may contain spaces
- `number` *boolean* - If set to true, the field value must be numeric
- `email` *boolean* - If set to true, the field value must match an email address. `FILTER_VALIDATE_EMAIL` is used for validation
- `phone` *boolean* - If set to true, the field value must match a phone number with a length between 3 to 18 characters. The characters can include a `+` in the beginning `-`, `space` or parantheses (`(` and `)`).
- `label` *string* - Sets the label contained in the error message

3. Initialize the form validator with the `$_POST` data and the created rules:

```
use FormValidate\Form;
$Form = new Form($_POST, $rules);
```

4. `$Form->validate()` returns `true` if the validation has been successfully done. If errors occur during the validation, `$Form->getErrors()` will return an `array` with at least one entry.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10748130?v=4)[Bob](/maintainers/webfashionist)[@webfashionist](https://github.com/webfashionist)

---

Top Contributors

[![webfashionist](https://avatars.githubusercontent.com/u/10748130?v=4)](https://github.com/webfashionist "webfashionist (14 commits)")

---

Tags

phpvalidationvalidator

### Embed Badge

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

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

###  Alternatives

[chaoswey/taiwan-id-validator

台灣身分證、統一編號驗證

319.9k](/packages/chaoswey-taiwan-id-validator)

PHPackages © 2026

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