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

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

lefuturiste/validator
=====================

A simple validator helper for PS7 requests

1.4.2(5y ago)11.5k1MITPHPPHP &gt;=7.4CI failing

Since Sep 16Pushed 5y agoCompare

[ Source](https://github.com/lefuturiste/validator)[ Packagist](https://packagist.org/packages/lefuturiste/validator)[ RSS](/packages/lefuturiste-validator/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (1)Versions (22)Used By (0)

Validator
=========

[](#validator)

[![Continuous integration](https://github.com/lefuturiste/validator/workflows/Continuous%20integration/badge.svg)](https://github.com/lefuturiste/validator/workflows/Continuous%20integration/badge.svg)

Simple php validator helper for PSR7 request.

How to use ?
------------

[](#how-to-use-)

### From PSR-7

[](#from-psr-7)

```
$validator = new Validator($request->getParsedBody());
```

### From php input

[](#from-php-input)

```
$validator = new Validator($_POST);
```

### Validate methods (or rules)

[](#validate-methods-or-rules)

```
$validator->required('example');
$validator->notEmpty('example');
```

And more validate methods (or rules)...

### Known if the input is valid

[](#known-if-the-input-is-valid)

```
$validator->isValid(); // TRUE|FALSE
```

### Get errors

[](#get-errors)

To get the list of all the errors that your input have you can use the getErrors() method which return all the errors as an array:

```
$validator->getErrors();
```

You can get errors in a different format, with the rules as key:

```
$validator->getErrors(\Validator\ValidationError::FORMAT_WITH_KEYS);
```

Or as a array of array, with each array representing an error with the key 'code' and 'message' (format to use in an JSON:API compliant API):

```
$validator->getErrors(\Validator\ValidationError::FORMAT_ARRAY);
```

If you dont' want to specify each time the ValidationError format you can use this static call to set as a setting for the whole project. For example if you want to set the FORMAT\_ARRAY as the default format for the whole project you can use this piece of code:

```
\Validator\ValidationError::setDefaultFormat(\Validator\ValidationError::FORMAT_ARRAY);
```

### I18n

[](#i18n)

English, french and spanish are supported

```
ValidationLanguage::setLang('fr'); // or `en` or `es`
```

Tests
-----

[](#tests)

All the tests are in the `tests` folder. You can run tests with theses commands (do a composer install before).

- With composer: `composer run test` or `composer run tests`
- On linux/mac: `vendor/bin/phpunit tests`
- On windows: `vendor/bin/phpunit.bat tests`

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 97.8% 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 ~61 days

Recently: every ~67 days

Total

21

Last Release

1986d ago

Major Versions

0.0.1.1 → 1.0.02017-09-16

PHP version history (2 changes)1.2PHP ^7.1

1.4.2PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/237a43763134833e785eaee2c646dc218b63a87a8b0943b585a7c9ce436fd306?d=identicon)[lefuturiste](/maintainers/lefuturiste)

---

Top Contributors

[![lefuturiste](https://avatars.githubusercontent.com/u/20988163?v=4)](https://github.com/lefuturiste "lefuturiste (45 commits)")[![thibaultjunin](https://avatars.githubusercontent.com/u/12583049?v=4)](https://github.com/thibaultjunin "thibaultjunin (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[chaoswey/taiwan-id-validator

台灣身分證、統一編號驗證

319.9k](/packages/chaoswey-taiwan-id-validator)

PHPackages © 2026

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