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

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

morebec/validator
=================

The Validator component provides tools to validate data.

0.2.0(6y ago)12161[7 issues](https://github.com/Morebec/Validator/issues)[7 PRs](https://github.com/Morebec/Validator/pulls)MITPHP

Since Jan 21Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Morebec/Validator)[ Packagist](https://packagist.org/packages/morebec/validator)[ RSS](/packages/morebec-validator/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

Validator
=========

[](#validator)

[![Build Status](https://camo.githubusercontent.com/fe4ec2a71f61f783b0fe17d8203bc52b5b1a5eee317c806792184abaec46528e/68747470733a2f2f7472617669732d63692e636f6d2f4d6f72656265632f56616c696461746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/Morebec/Validator)

The Validator component makes data validation easy. Its primary use is intended to ensure that the data of forms, Rest API and configuration files is in an appropriate and valid state.

A lot of validation libraries rely on an exception mechanism. This forces developers to check multiple related data fields one by one. This component instead uses validation errors that can be used for multiple pieces of data together. This is useful for example to return all errors for a given form at once.

Installation
------------

[](#installation)

```
composer require morebec/validator
```

Usage
-----

[](#usage)

```
use Morebec\Validator\Rule as Assert;
use Morebec\Validator\Validator;

// Validate a single rule for a given field
Validator::validate($form['email_address'], new Assert\One(
    new Assert\IsString('The email address field was expected to be a string')
));

// Validate Multiple Rules for a given field
Validator::validate($form['email_address'], new Assert\All([
    new Assert\IsString('The email address field was expected to be a string'),
    new Assert\NotBlank('The email address field was expected not to be blank'),
    new Assert\IsEmail('The email address field was expected to be a valid email address'),
]));

// Ensure At least one rule is valid
Validator::validate($form['email_address'], new Assert\AtLeastOne([
    new Assert\IsString('The email address field was expected to be a string'),
    new Assert\NotBlank('The email address field was expected not to be blank'),
    new Assert\IsEmail('The email address field was expected to be a valid email address'),
]));
```

Running Tests
-------------

[](#running-tests)

```
php vendor/bin/phpunit --bootstrap vendor/autoload.php tests
```

Contributing
------------

[](#contributing)

Thank you for your interest :)
To contribute, please read the `CONTRIBUTING.md` guidelines.

Getting help
------------

[](#getting-help)

To get help, open a new issue on this repository.
For Morebec team members, please use the appropriate internal channels.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.6% 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 ~45 days

Total

2

Last Release

2264d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/10d7f5561446f2d4df4413803946e9f77175155d241f78bd65c0dd94e6caffc5?d=identicon)[jwillp](/maintainers/jwillp)

---

Top Contributors

[![jwillp](https://avatars.githubusercontent.com/u/5913483?v=4)](https://github.com/jwillp "jwillp (22 commits)")[![mboiev](https://avatars.githubusercontent.com/u/19554293?v=4)](https://github.com/mboiev "mboiev (4 commits)")[![edcaracas](https://avatars.githubusercontent.com/u/83022392?v=4)](https://github.com/edcaracas "edcaracas (2 commits)")

---

Tags

orkestraphpvalidationvalidator

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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