PHPackages                             utopia-php/validators - 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. utopia-php/validators

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

utopia-php/validators
=====================

A lightweight collection of reusable validators for Utopia projects

0.2.0(4mo ago)4119.0k↓19.8%[1 PRs](https://github.com/utopia-php/validators/pulls)12MITPHPPHP &gt;=8.0

Since Oct 20Pushed 2mo agoCompare

[ Source](https://github.com/utopia-php/validators)[ Packagist](https://packagist.org/packages/utopia-php/validators)[ RSS](/packages/utopia-php-validators/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (7)Used By (12)

Utopia Validators
=================

[](#utopia-validators)

Reusable validation building blocks for [Utopia](https://github.com/utopia-php) projects.
This package exposes a consistent API for common HTTP-oriented validation concerns such as input sanitisation, URL checks, IP validation, hostname filtering, lists enforcement, and more.

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

[](#installation)

```
composer require utopia-php/validators
```

Usage
-----

[](#usage)

```
use Utopia\Validator\Text;
use Utopia\Validator\Range;

$username = new Text(20, min: 3);
$age = new Range(min: 13, max: 120);

if (! $username->isValid($input['username'])) {
    throw new InvalidArgumentException($username->getDescription());
}

if (! $age->isValid($input['age'])) {
    throw new InvalidArgumentException($age->getDescription());
}
```

Validators expose a predictable contract:

- `isValid(mixed $value): bool` – core validation rule
- `getDescription(): string` – human readable rule summary
- `getType(): string` – expected PHP type (string, integer, array, ...)
- `isArray(): bool` – hint whether the validator expects an array input

For advanced flows combine validators with `Multiple`, `AnyOf`, `AllOf`, `NoneOf`, or wrap checks with helpers such as `Nullable`.

Available Validators
--------------------

[](#available-validators)

- `AllOf`, `AnyOf`, `NoneOf`, `Multiple` – composition helpers
- `ArrayList`, `Assoc`, `Nullable`, `WhiteList`, `Wildcard`
- `Boolean`, `Integer`, `FloatValidator`, `Numeric`, `Range`
- `Domain`, `Host`, `Hostname`, `IP`, `URL`
- `HexColor`, `JSON`, `Text`

Development
-----------

[](#development)

Run the static analysis and test suites from the project root:

```
composer check
composer test
```

This project is released under the [MIT License](LICENSE.md).

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance80

Actively maintained with recent releases

Popularity37

Limited adoption so far

Community28

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor3

3 contributors hold 50%+ of commits

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

Total

4

Last Release

125d ago

PHP version history (2 changes)0.0.1PHP &gt;=8.1

0.1.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/023f08a9df59f81cc4a04b1cebd20f45ede5db53ef2f9e9ad3d75f4c69be66b8?d=identicon)[eldadfux](/maintainers/eldadfux)

---

Top Contributors

[![eldadfux](https://avatars.githubusercontent.com/u/1297371?v=4)](https://github.com/eldadfux "eldadfux (248 commits)")[![lohanidamodar](https://avatars.githubusercontent.com/u/6360216?v=4)](https://github.com/lohanidamodar "lohanidamodar (188 commits)")[![Meldiron](https://avatars.githubusercontent.com/u/19310830?v=4)](https://github.com/Meldiron "Meldiron (133 commits)")[![TorstenDittmann](https://avatars.githubusercontent.com/u/1759475?v=4)](https://github.com/TorstenDittmann "TorstenDittmann (92 commits)")[![christyjacob4](https://avatars.githubusercontent.com/u/20852629?v=4)](https://github.com/christyjacob4 "christyjacob4 (63 commits)")[![kodumbeats](https://avatars.githubusercontent.com/u/9708641?v=4)](https://github.com/kodumbeats "kodumbeats (38 commits)")[![abnegate](https://avatars.githubusercontent.com/u/5857008?v=4)](https://github.com/abnegate "abnegate (36 commits)")[![loks0n](https://avatars.githubusercontent.com/u/22452787?v=4)](https://github.com/loks0n "loks0n (30 commits)")[![byawitz](https://avatars.githubusercontent.com/u/316103?v=4)](https://github.com/byawitz "byawitz (22 commits)")[![vermakhushboo](https://avatars.githubusercontent.com/u/43381712?v=4)](https://github.com/vermakhushboo "vermakhushboo (15 commits)")[![aaryan2134](https://avatars.githubusercontent.com/u/22559451?v=4)](https://github.com/aaryan2134 "aaryan2134 (13 commits)")[![ChiragAgg5k](https://avatars.githubusercontent.com/u/110609663?v=4)](https://github.com/ChiragAgg5k "ChiragAgg5k (13 commits)")[![shimonewman](https://avatars.githubusercontent.com/u/23742426?v=4)](https://github.com/shimonewman "shimonewman (8 commits)")[![stnguyen90](https://avatars.githubusercontent.com/u/1477010?v=4)](https://github.com/stnguyen90 "stnguyen90 (7 commits)")[![thinkverse](https://avatars.githubusercontent.com/u/2221746?v=4)](https://github.com/thinkverse "thinkverse (7 commits)")[![basert](https://avatars.githubusercontent.com/u/1951610?v=4)](https://github.com/basert "basert (6 commits)")[![hmacr](https://avatars.githubusercontent.com/u/132386067?v=4)](https://github.com/hmacr "hmacr (2 commits)")[![ebenezerdon](https://avatars.githubusercontent.com/u/43746609?v=4)](https://github.com/ebenezerdon "ebenezerdon (2 commits)")[![Aadeesh11](https://avatars.githubusercontent.com/u/66922161?v=4)](https://github.com/Aadeesh11 "Aadeesh11 (2 commits)")[![PineappleIOnic](https://avatars.githubusercontent.com/u/26739219?v=4)](https://github.com/PineappleIOnic "PineappleIOnic (2 commits)")

---

Tags

phpvalidatorvalidationutopia

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/utopia-php-validators/health.svg)

```
[![Health](https://phpackages.com/badges/utopia-php-validators/health.svg)](https://phpackages.com/packages/utopia-php-validators)
```

###  Alternatives

[vlucas/valitron

Simple, elegant, stand-alone validation library with NO dependencies

1.6k4.4M128](/packages/vlucas-valitron)

PHPackages © 2026

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