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

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

gabrieljmj/simple-validator
===========================

To simple validations in PHP.

08PHP

Since Jul 29Pushed 11y ago1 watchersCompare

[ Source](https://github.com/GabrielJMJ/simple-validator)[ Packagist](https://packagist.org/packages/gabrieljmj/simple-validator)[ RSS](/packages/gabrieljmj-simple-validator/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#simple-validator)

[![Total Downloads](https://camo.githubusercontent.com/feac8eff0e22ab078b7c464a2ffb44ebadde6bbdad7194dd5664f69ee2602602/68747470733a2f2f706f7365722e707567782e6f72672f6761627269656c6a6d6a2f73696d706c652d76616c696461746f722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/gabrieljmj/simple-validator) [![Latest Unstable Version](https://camo.githubusercontent.com/ac90a47339939dfc8663d9069126569e4e5714943f7ec99c7aa31568e79a9eff/68747470733a2f2f706f7365722e707567782e6f72672f6761627269656c6a6d6a2f73696d706c652d76616c696461746f722f762f756e737461626c652e706e67)](https://packagist.org/packages/gabrieljmj/simple-validator) [![License](https://camo.githubusercontent.com/fe72e4e4df3d4c608b3663a39648013f1d79a81e66a5e3c9ed5bd8712d0ea0cd/68747470733a2f2f706f7365722e707567782e6f72672f6761627269656c6a6d6a2f73696d706c652d76616c696461746f722f6c6963656e73652e706e67)](https://packagist.org/packages/gabrieljmj/simple-validator) [![Quality](https://camo.githubusercontent.com/c21e077e68429e23ea6c3a701b42d1343759ec143c8cd8f0f511269cae920981/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4761627269656c4a4d4a2f73696d706c652d76616c696461746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/GabrielJMJ/simple-validator/)

To simple validations in PHP. ##Autoload ####Via composer

```
{
    "psr-4": {
        "SimpleValidator\\": "vendor/gabrieljmj/simple-validator/lib/SimpleValidator/"
    }
}
```

\####Autoload file

```
require_once SIMPLE_VALIDATOR_DIR . DIRECTORY_SEPARATOR . 'autoload' . DIRECTORY_SEPARATOR . 'autoload.php'
```

\##Validations ####Chain The implementation will be in a chain, where you'll show what the next validation for that element. ####SimpleValidatorException This is the exception that is thrown when one validation to fail and the exception are enabled.

`SimpleValidatorException::getInvalidParameterName()`Return what validation failure

\####Validations list

- `Arr` Verify if element is an array
- `Boolean` Verify if element is a boolean
- `Callable` Verify if element is a callable
- `Cpf` Verify if element is a Cpf
- `Directory` Verify if element is a directory
- `Double` Verify if element is a duble
- `Email` Verify if element is an email
- `Equal` Verify if element is equal to another
- `File` Verify if element is a file
- `Float` Verify if element is a float
- `Func` Verify if element is a function
- `Int` Verify if element is an integer
- `Lenght` Verify if element is the specified size
- `MaximumLenght` Verify if element have the maximum specified size
- `Method` Verify if element is a class's method
- `MinimumLenght` Verify if element have the minimum specified size
- `NotEmpty` Verify if element is not empty
- `Null` Verify if element is null
- `Numeric` Verify if element is numeric
- `Object` Verify if element is an object
- `String` Verify if element is a string
- `Url` Verify if element is an URL

\##Implemeting ####Enabled exception

```
use SimpleValidator\Validator\NotEmpty;
use SimpleValidator\Validator\Url;
use SimpleValidator\Exception\SimpleValidatorException;

//...

$url = 'http://example.com';

$validator = new NotEmpty; // verify if string is not empty
$validator->setSucessor( new Url ); // verify if string is an URL

try{
  $validator->validate( $url, true ); // realize all validations predefined
}catch( SimpleValidatorException $e ){
   echo 'Error: ' . $e->getMessage() . ' On test: ' . $e->getInvalidParameterName();
}
```

\####Disabled exception

```
use SimpleValidator\Validator\NotEmpty;
use SimpleValidator\Validator\Url;

//...

$url = 'http://example.com';

$validator = new NotEmpty; // verify if string is not empty
$validator->setSucessor( new Url ); // verify if string is an URL

if( $validator->validate( $url ) ){ // realize all validations predefined
    //Success
}{
    //Fail
}
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

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/4fcbdf815749595d3dcfd4fb781e2cac05aa6d132123aa9da889d2c5ca6c8e11?d=identicon)[GabrielJMJ](/maintainers/GabrielJMJ)

---

Top Contributors

[![gabrieljmj](https://avatars.githubusercontent.com/u/2223216?v=4)](https://github.com/gabrieljmj "gabrieljmj (22 commits)")

### Embed Badge

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

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

PHPackages © 2026

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