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

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

deskola/simple-validator
========================

This is a simple validator library adapted from https://www.phptutorial.net/php-tutorial/

v1.0.5(3y ago)11.0k2MITPHP

Since Jun 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Deskola/simple-validator)[ Packagist](https://packagist.org/packages/deskola/simple-validator)[ RSS](/packages/deskola-simple-validator/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (6)Dependencies (2)Versions (8)Used By (0)

Simple Validator
================

[](#simple-validator)

What is it? ---

-----------------

[](#what-is-it-)

A PHP library for sanitizing and validating user inputs. This library is based on  tutorial on how to make a custom input validator form scratch.

1. Installation
2. Supported input types
3. Usage

Installation ---

------------------

[](#installation---)

PHP versions 7.1 up to PHP 8.1 are currently supported.

The PECL mbstring extension is required.

It is recommended to use composer to install the library.

```
composer require deskola/simple-validator

```

You can also use any other PSR-4 compliant autoloader.

If you do not use composer, ensure that you also load any dependencies that this project has, such as giggsey/locale.

Supported input types ---

---------------------------

[](#supported-input-types-)

Below is the list of data type which will be sanitized against. Any data type not in the list will be result into an error

1. string
2. int
3. email
4. float
5. url

Supported Rules ---

---------------------

[](#supported-rules-)

Below are the rule that can be passed against an input

RuleRule nameParameterMeaningrequiredrequiredNoThe field is set and not emptyalphanumericalphanumericNoThe field only contains letters and numbersemailemailNoThe field is a valid email addresssecuresecureNoThe field must have between 8 and 64 characters and contain at least one number, one upper case letter, one lower case letter, and one special character. This rule is for the password field. example (!@#$%^&amp;\*+\_)min: 3minAn integer specifies the minimum length of the fieldThe length of the field must be greater than or equal to min length, e.g., 3max: 255maxAn integer specifies the maximum length of the fieldThe length of the field must be less than or equal to min length, e.g., 255same: another\_fieldsameThe name of another fieldThe field value must be the same as the value of the another\_fieldbetween: min, maxbetweenmin and max are integers that specify the minimum and maximum length of the fieldThe length of the field must be between min and max.urlurlNoThe field must have a valid url starting with (http/https://)iso:KEisoA string value of country ISO Name e.g. KE (for Kenya)This library also utilises giggsey library to validate phone number based on a country ISO Nameoptions:1,2optionscomma separated list of items being validated againstUsage ---

-----------

[](#usage-)

```
require_once  'vendor/autoload.php';
$validation = new Deskola\SimpleValidator\InputFilter();

$data = [
    'name' => 'Doe',
    'email' => 'john@email.com',
    'phone' => '2547********'
];

$iso = "KE";
$fields = [
    'name' => "string| required | max: 3",
    'email' => 'email| required | email',
    'phone' => 'string| required | iso:KE'
];

$response = $validation->filter($data, $fields);

print_r($response);
```

### Success Output

[](#success-output)

```
Array
(
)
```

### Error Output

[](#error-output)

```
Array
(
    [name] => The name must have at most 3 characters
    [email] => The email is not a valid email address
    [phone] => The phone must be a valid phone number
)
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.7% 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 ~73 days

Recently: every ~91 days

Total

6

Last Release

1097d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a114873ea7f1bac8e26365c6a7a5fb2de329d72d1721429b573ee65bdbb16b8?d=identicon)[drizla](/maintainers/drizla)

---

Top Contributors

[![Deskola](https://avatars.githubusercontent.com/u/31285454?v=4)](https://github.com/Deskola "Deskola (16 commits)")[![Nodedrizla](https://avatars.githubusercontent.com/u/114143814?v=4)](https://github.com/Nodedrizla "Nodedrizla (6 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[ronanguilloux/isocodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers &amp; Zipcodes for many countries

8043.4M26](/packages/ronanguilloux-isocodes)[borales/yii2-phone-input

Yii2 International telephone numbers - Asset Bundle, Behavior, Validator, Widget

1331.7M6](/packages/borales-yii2-phone-input)[verbb/formie

The most user-friendly forms plugin for Craft.

100387.6k57](/packages/verbb-formie)[bitrix24/b24phpsdk

An official PHP library for the Bitrix24 REST API

10139.4k5](/packages/bitrix24-b24phpsdk)[udokmeci/yii2-phone-validator

Modern Yii2 Phone validator wrapper on top of PhoneNumberUtil library also used by Android devices

36222.9k1](/packages/udokmeci-yii2-phone-validator)[ipub/phone

Phone helper &amp; validator for Nette Framework

1286.1k6](/packages/ipub-phone)

PHPackages © 2026

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