PHPackages                             accexs/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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. accexs/validator

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

accexs/validator
================

Extensible OOP PHP input validation package based on wixel/gump (https://wixelhq.com) and laravel

1.1.0(8y ago)1150MITPHPPHP &gt;=5.6

Since Apr 17Pushed 8y agoCompare

[ Source](https://github.com/accexs/validator)[ Packagist](https://packagist.org/packages/accexs/validator)[ Docs](https://github.com/accexs/)[ RSS](/packages/accexs-validator/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (3)Used By (0)

Getting started
===============

[](#getting-started)

Validator class in object oriented PHP based on

###### Install with composer

[](#install-with-composer)

Add the following to your composer.json file:

```
{
    "require": {
        "accexs/validator": "dev-master"
    }
}
```

Then open your terminal in your project directory and run:

`composer install`

or just do:

`composer require accexs/validator`

Example
=======

[](#example)

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

$validator = new Accexs\Validator;

$valid = $validator->validation_rules(array(
	'username'    => 'required|alpha_num|max_len,100|min_len,6',
	'password'    => 'required|max_len,100|min_len,6',
	'email'       => 'required|email',
	'gender'      => 'required|exact_len,1|contains,m f',
	'credit_card' => 'required|creditcard'
));

print_r($valid);
```

Available Validators
--------------------

[](#available-validators)

- required `Ensures the specified key value exists and is not empty`
- email `Checks for a valid email address`
- maxlen:n `Checks key value length, makes sure it's not longer than the specified length. n = length parameter.`
- minlen,n `Checks key value length, makes sure it's not shorter than the specified length. n = length parameter.`
- exact\_len:n (TODO) `Ensures that the key value length precisely matches the specified length. n = length parameter.`
- alpha `Ensure only alpha characters are present in the key value (a-z, A-Z)`
- alpha\_num `Ensure only alpha-numeric characters are present in the key value (a-z, A-Z, 0-9)`
- alpha\_dash `Ensure only alpha-numeric characters + dashes and underscores are present in the key value (a-z, A-Z, 0-9, _-)`
- alpha\_space (TODO) `Ensure only alpha-numeric characters + spaces are present in the key value (a-z, A-Z, 0-9, \s)`
- numeric `Ensure only numeric key values`
- integer `Ensure only integer key values`
- boolean `Checks for PHP accepted boolean values, returns TRUE for "1", "true", "on" and "yes"`
- float `Checks for float values`
- url `Check for valid URL or subdomain`
- ip `Check for valid generic IP address`
- ipv4 `Check for valid IPv4 address`
- ipv6 `Check for valid IPv6 address`
- creditcard `Check for a valid credit card number (Uses the MOD10 Checksum Algorithm)`
- contains:n (TODO) `Verify that a value is contained within the pre-defined value set`
- contains\_list:n (TODO) `Verify that a value is contained within the pre-defined value set. The list of valid values must be provided in semicolon-separated list format (like so: value1;value2;value3;..;valuen). If a validation error occurs, the list of valid values is not revelead (this means, the error will just say the input is invalid, but it won't reveal the valid set to the user.`
- doesnt\_contain\_list:n (TODO) `Verify that a value is not contained within the pre-defined value set. Semicolon (;) separated, list not outputted. See the rule above for more info.`
- min\_numeric (TODO) `Determine if the provided numeric value is higher or equal to a specific value`
- max\_numeric (TODO) `Determine if the provided numeric value is lower or equal to a specific value`
- date `Determine if the provided input is a valid date (ISO 8601)`
- starts `Ensures the value starts with a certain character / set of character`
- phone\_number `Validate phone numbers that match the following examples: 555-555-5555 , 5555425555, 555 555 5555, 1(519) 555-4444, 1 (519) 555-4422, 1-555-555-5555`
- regex `You can pass a custom regex using the following format: 'regex,/your-regex/'`
- json `validate string to check if it's a valid json format`

Creating your own validators
============================

[](#creating-your-own-validators)

Adding custom validators and filters is made easy by using callback functions.

```
require("gump.class.php");

/*
   Create a custom validation rule named "is_object".
   The callback receives 3 arguments:
   The field to validate, the values being validated, and any parameters used in the validation rule.
   It should return a boolean value indicating whether the value is valid.
*/
GUMP::add_validator("is_object", function($field, $input, $param = NULL) {
    return is_object($input[$field]);
});

/*
   Create a custom filter named "upper".
   The callback function receives two arguments:
   The value to filter, and any parameters used in the filter rule. It should returned the filtered value.
*/
GUMP::add_filter("upper", function($value, $params = NULL) {
    return strtoupper($value);
});
```

Set Custom Field Names
======================

[](#set-custom-field-names)

You can easily override your form field names for improved readability in errors using the `GUMP::set_field_name($field, $readable_name)` method as follows:

```
$data = array(
	'str' => null
);

$rules = array(
	'str' => 'required'
);

GUMP::set_field_name("str", "Street");

$validated = GUMP::is_valid($data, $rules);

if($validated === true) {
	echo "Valid Street Address\n";
} else {
	print_r($validated);
}
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

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.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

2949d ago

### Community

Maintainers

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

---

Top Contributors

[![accexs](https://avatars.githubusercontent.com/u/6426734?v=4)](https://github.com/accexs "accexs (1 commits)")

---

Tags

validatorvalidation

### Embed Badge

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

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

###  Alternatives

[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M383](/packages/respect-validation)[opis/json-schema

Json Schema Validator for PHP

64236.9M186](/packages/opis-json-schema)[vlucas/valitron

Simple, elegant, stand-alone validation library with NO dependencies

1.6k4.4M128](/packages/vlucas-valitron)[intervention/validation

Additional validation rules for the Laravel framework

6826.7M8](/packages/intervention-validation)[proengsoft/laravel-jsvalidation

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

1.1k2.3M49](/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.3M30](/packages/wixel-gump)

PHPackages © 2026

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