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

361PHP

Since May 17Pushed 8y 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 1mo ago

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 19% 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://www.gravatar.com/avatar/d3a75d03e3eedd897ceb53632aa4ca09eaeeb8a63257289c38e1a31656696350?d=identicon)[webfashionist](/maintainers/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

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[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.2M446](/packages/nette-forms)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)

PHPackages © 2026

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