PHPackages                             eboybasit/validator - 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. eboybasit/validator

ActiveLibrary

eboybasit/validator
===================

00PHP

Since Sep 18Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Basitowaisi/validation)[ Packagist](https://packagist.org/packages/eboybasit/validator)[ RSS](/packages/eboybasit-validator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

FORM DATA VALIDATION PACKAGE
============================

[](#form-data-validation-package)

This is a validation package which makes the process of validating your form data easy and seemless. This isn't much but can be beneficial at times.

Installation:
-------------

[](#installation)

> To use this package you must have php version 7 or more installed in your machine

- Start by installing this package to your machine
- Open up your command prompt or Terminal and type the following command in the shell

```
composer require eboybasit/validator
```

Usage:
------

[](#usage)

### Step 1.

[](#step-1)

> Import following file into your project

```
require_once 'vendor/autoload.php';
```

### Step 2.

[](#step-2)

> Next, Assuming the data variable contains the data from your server in associative array form, then you can validate your data in either of the following ways:

Please note that the size of the two arrays i.e., the data array and validation rules array should be same.

```
$data = [
	'email' => 'example@gmail.com',
	'email_confirm' => 'example@gmail.com',
	'phone' => '9622428688',
	'num' => 12,
	'color' => '#ff98ff'
];
$rules = [
	'required|email',
	'required|matches:email' ,
	'required|phone',
	'gte:13',
	'hex|minmax:3-6'
];
```

Data validation can be done in either of the two ways.

```
 $validation = App::validate($data, $rules);
 if( $validation->passes() ){
	// write here logic if the validation test passed.
} else {
	// write here the logic for validation test failure.
}
```

### OR

[](#or)

```
if( validate($data, $rules)->passes() ){
	// write here logic if the validation test passed.
} else {
	// write here the logic for validation test failure.
}
```

### Step 3.

[](#step-3)

> You can also set custom error messages or rely on default error messages.

Open messages.php Under custom key create your own error messages for different types of rules.

Please note that rule name in custom messages array should match the rule name of default array, so that it will override the default message properly

For example:

```
	'custom' => [
		'hex' 	 	 => 'Please enter a 3 digit or 6 digit valid hex code',
		'minmax' 	 => //your message here,
		//rulename => custom error message

	];
```

### Step 4.

[](#step-4)

> You can fetch errors using this function.This function call returns all the validation errors.

```
$errors = errors()->all();
```

The Various Validation Rules Offered by the Spec are:
-----------------------------------------------------

[](#the-various-validation-rules-offered-by-the-spec-are)

- ### required

    [](#required)

```
	It ensures that the field passed contains some data or is set or is not null.

```

- ### email

    [](#email)

```
	It ensures that the field passed is of the type email and does not start with a number

```

- ### matches

    [](#matches)

```
	It ensures that this attributes value should match the other attributes values which is specified after colon

```

- ### lt

    [](#lt)

```
	It ensures that the value passed is less than a certain number which is specified after colon

```

- ### lte

    [](#lte)

```
	It ensures that the value passed is less than or equal to a certain number which is specified after colon

```

- ### gt

    [](#gt)

```
	It ensures that the value passed is greater than a certain number which is specified after colon

```

- ### gte

    [](#gte)

```
	It ensures that the value passed is greater than or equal to a certain number which is specified after colon

```

- ### min

    [](#min)

```
	It ensures that the field data length should be aleast a number which is specified after colon

```

- ### max

    [](#max)

```
	It ensures that the field data length should be atmost a number which is specified after colon

```

- ### minmax

    [](#minmax)

```
	It ensures that the field data length should be aleast a number and should not be more than a number which is specified after colon separated by a hyphen

```

- ### phone

    [](#phone)

```
	It ensures that the field data should be a valid phone number

```

- ### hex

    [](#hex)

```
	It ensures that the field data should be a valid hex color. Either 3 digits or 6 digits hex values are allowed.

```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 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/37a3ec922ebb05e6a1985bd55f37c4e0667d138fd51a2c09947913d9bc42fd51?d=identicon)[Basitowaisi](/maintainers/Basitowaisi)

---

Top Contributors

[![Basitowaisi](https://avatars.githubusercontent.com/u/23507477?v=4)](https://github.com/Basitowaisi "Basitowaisi (3 commits)")

### Embed Badge

![Health badge](/badges/eboybasit-validator/health.svg)

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

PHPackages © 2026

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