PHPackages                             rutkoski/simplify-validation - 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. rutkoski/simplify-validation

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

rutkoski/simplify-validation
============================

Validation library

1.0.2(9y ago)11.4kGPLPHPPHP &gt;=5.3

Since Mar 31Pushed 9y ago1 watchersCompare

[ Source](https://github.com/rutkoski/simplify-validation)[ Packagist](https://packagist.org/packages/rutkoski/simplify-validation)[ Docs](https://github.com/rutkoski/simplify-validation)[ RSS](/packages/rutkoski-simplify-validation/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Simplify Validation
===================

[](#simplify-validation)

Validation library.

Usage
-----

[](#usage)

### Validate single value/rule

[](#validate-single-valuerule)

```
try {
	$name = 'Ford';

	$rule = new \Simplify\Validation\Required('Invalid name');
	$rule->validate($name);
}
catch (\Simplify\ValidationException $e) {
	$errors = $e->getErrors();

	var_dump($errors);
}
```

### Validate multiple values/rules

[](#validate-multiple-valuesrules)

```
try {
	$data = array(
		'name' => 'Ford Prefect',
		'email' => 'ford.prefect@gmail.com',
		'gender' => 'M',
		'age' => '23',
		'message' => 'Don\'t panic',
	);

	$rules = new \Simplify\Validation\DataValidation();
	$rules->setRule('name', new \Simplify\Validation\Required('Invalid name'));
	$rules->setRule('name', new \Simplify\Validation\Length('Name too short', 3));
	$rules->setRule('email', new \Simplify\Validation\Email('Invalid email!'));
	$rules->setRule('gender', new \Simplify\Validation\Enum('Invalid gender!', array('M', 'F')));
	$rules->setRule('age', new \Simplify\Validation\Refex('Invalid age', '/^\d{2}$/'));
	$rules->setRule('message', new \Simplify\Validation\Length('Invalid message', 1, 255));
	$rules->validate($data);
}
catch (\Simplify\ValidationException $e) {
	$errors = $e->getErrors();

	var_dump($errors);
}
```

#### Alternative syntax

[](#alternative-syntax)

```
try {
    $data = array(
        'name' => 'Ford Prefect',
        'email' => 'ford.prefect@gmail.com',
        'gender' => 'M',
        'age' => '23',
        'message' => 'Don\'t panic',
    );

    $rules = new \Simplify\Validation\DataValidation(array(
        'name' => array(
            array('\Simplify\Validation\Required', 'Invalid name'),
            array('\Simplify\Validation\Length', 'Name too short', array('min' => 3))
        ),
        'email' => array('\Simplify\Validation\Email', 'Invalid email!'),
        'gender' => array('\Simplify\Validation\Enum', 'Invalid gender!', array('enum' => array('M', 'F'))),
        'age' => array('\Simplify\Validation\Refex', 'Invalid age', array('regex' => '/^\d{2}$/')),
        'message' => array('\Simplify\Validation\Length', 'Invalid message', array('min' => 1, 'max' => 255)),
    ));
    $rules->validate($data);
}
catch (\Simplify\ValidationException $e) {
    $errors = $e->getErrors();

    var_dump($errors);
}
```

Available validators
--------------------

[](#available-validators)

- `\Simplify\Validation\Callback`

Validation using a valid php callback of the format:

```
$rule = new \Simplify\Validation\Callback('myValidator');

function myValidator($value) {
	// your validation

	throw new \Simplify\ValidationException('Don\'t panic');
}
```

- `Simplify\Validation\Email` (required?)
- `Simplify\Validation\Enum` (list of valid values)
- `Simplify\Validation\Length` (min, max)
- `Simplify\Validation\Password`
- `Simplify\Validation\Regex` (regular expression)
- `Simplify\Validation\Required`
- `Simplify\Validation\StrictEqual`

Brazilian formats (validação de formatos brasileiros):

- CEP (validar formato de CEP)
- CNPJ
- CPF
- Telefone

### Writing custom validators

[](#writing-custom-validators)

Custom validators must implement `\Simplify\ValidationInterface` or extend on the base classes.

Example:

```
class CustomValidator implements \Simplify\ValidationInterface
{

	protected $message;

	function __construct($message)
	{
		$this->message = $message;
	}

	public function getError()
	{
		return $this->message;
	}

	public function validate($value)
	{
		// custom validation
		throw new \Simplify\ValidationException('Don\'t panic');
	}
}
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~161 days

Total

3

Last Release

3423d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/38a8aa56ccd4771bee20cd5472ee31e01d6a0ffa1cabe46996b78067ed5c2994?d=identicon)[rutkoski](/maintainers/rutkoski)

---

Top Contributors

[![rutkoski](https://avatars.githubusercontent.com/u/165532?v=4)](https://github.com/rutkoski "rutkoski (29 commits)")

---

Tags

phpvalidation

### Embed Badge

![Health badge](/badges/rutkoski-simplify-validation/health.svg)

```
[![Health](https://phpackages.com/badges/rutkoski-simplify-validation/health.svg)](https://phpackages.com/packages/rutkoski-simplify-validation)
```

###  Alternatives

[yorcreative/laravel-argonaut-dto

Argonaut is a lightweight Data Transfer Object (DTO) package for Laravel that supports nested casting, recursive serialization, and validation out of the box. Ideal for service layers, APIs, and clean architecture workflows.

1063.4k2](/packages/yorcreative-laravel-argonaut-dto)

PHPackages © 2026

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