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

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

rudra/validation
================

Rudra framework

v26.7.27(1mo ago)15672MPL-2.0PHPPHP ^8.3CI passing

Since Jun 5Pushed 2w ago1 watchersCompare

[ Source](https://github.com/Jagepard/Rudra-Validation)[ Packagist](https://packagist.org/packages/rudra/validation)[ RSS](/packages/rudra-validation/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (4)Versions (13)Used By (2)

[![PHPunit](https://github.com/Jagepard/Rudra-Validation/actions/workflows/php.yml/badge.svg)](https://github.com/Jagepard/Rudra-Validation/actions/workflows/php.yml)[![Maintainability](https://camo.githubusercontent.com/1d4f980bbf5fef9eeb260fc9e02a0922d5af43ef53c10e087b8017b8b4aa111a/68747470733a2f2f716c74792e73682f6261646765732f39336364323062392d376234392d343563302d616231322d3233333831313835643238662f6d61696e7461696e6162696c6974792e737667)](https://qlty.sh/gh/Jagepard/projects/Rudra-Validation)[![CodeFactor](https://camo.githubusercontent.com/2e5738f93b2e5669451d19b9d6d492669e97fa072437f06948aec3c9b3633852/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f6a616765706172642f72756472612d76616c69646174696f6e2f6261646765)](https://www.codefactor.io/repository/github/jagepard/rudra-validation)[![Coverage Status](https://camo.githubusercontent.com/ac47e291aed6c6fb43d0123d19b0f92ba2dc30e2754e420b36cb3df6610cd145/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4a616765706172642f52756472612d56616c69646174696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Jagepard/Rudra-Validation?branch=master)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#)

Rudra-Validation | [API](https://github.com/Jagepard/Rudra-Validation/blob/master/docs.md "Documentation API")
==============================================================================================================

[](#rudra-validation--api)

### Installation

[](#installation)

```
composer require rudra/validation

```

Features
--------

[](#features)

- Fluent Interface for chain validation
- Built-in sanitization (HTML tags, trimming)
- CSRF protection
- Custom validation rules
- Human-readable error messages with field aliases
- Strict type checking

Available Rules
---------------

[](#available-rules)

RuleDescriptionExample`required()`Field must not be empty`->required()``min(int $length)`Minimum string length`->min(3)``max(int $length)`Maximum string length`->max(255)``email()`Valid email address`->email()``url()`Valid URL`->url()``integer()`Integer value`->integer()``numeric()`Numeric value (int or float)`->numeric()``between(int|float $min, int|float $max)`Value in range`->between(1, 100)``equals(mixed $value)`Strict equality`->equals('password123')``in(array $allowed)`Value in allowed list`->in(['admin', 'user'])``regex(string $pattern)`Match regex pattern`->regex('/^[A-Z]{3}$/')``date(string $format)`Valid date format`->date('Y-m-d')``csrf(array $tokens)`CSRF token validation`->csrf($_SESSION['csrf'])``custom(callable $callback)`Custom validation`->custom(fn($v) => strlen($v) > 5)``sanitize(string $value)`Strip HTML tags`->sanitize($input, '')`### Example of usage

[](#example-of-usage)

```
use Rudra\Validation\ValidationFacade;

$_SESSION['csrf'][] = '123456';

$processed = [
    'set_without_validation' => ValidationFacade::set('set_without_validation')->run(),
    'set_with_data_clearing' => ValidationFacade::sanitize(' String ')->run(),

    'required' => ValidationFacade::set('required')->required()->run(),
    'integer'  => ValidationFacade::set(12345)->required()->integer()->run(),
    'minimum'  => ValidationFacade::set('12345')->required()->min(5)->run(),
    'maximum'  => ValidationFacade::set('12345')->required()->max(5)->run(),
    'equals'   => ValidationFacade::set('12345')->equals('12345')->run(),
    'email'    => ValidationFacade::email('user@example.com')->run(),
    'csrf'     => ValidationFacade::set('123456')->csrf($_SESSION['csrf'])->run()
];
```

Data is validated in a chain

### For example:

[](#for-example)

```
ValidationFacade::sanitize(' 12345 ')->required()->min(3)->max(10)->equals('12345')->run();
ValidationFacade::email('user@example.com')->max(25)->run();
```

### Data validation check

[](#data-validation-check)

```
if (ValidationFacade::approve($processed)) {
    $validated = ValidationFacade::getValidated($processed, ["csrf", "_method"]);
}
```

##### getValidated

[](#getvalidated)

Gets an array of validated data excluding the keys \["csrf", "\_method"\]

### Get all error messages

[](#get-all-error-messages)

```
ValidationFacade::getErrors($processed, ['required']);
```

##### getAlerts

[](#getalerts)

Gets an array with error messages excluding the keys \['required'\]

### Using field aliases

[](#using-field-aliases)

```
use Rudra\Validation\ValidationFacade;

ValidationFacade::setAliases([
    'usr_name' => 'Username',
    'usr_email' => 'Email Address'
]);

$processed = [
    'usr_name'  => ValidationFacade::set($_POST['usr_name'])->required()->min(3)->run(),
    'usr_email' => ValidationFacade::email($_POST['usr_email'])->run(),
];

$errors = ValidationFacade::getErrors($processed);
// Returns: ['usr_name' => ['msg' => 'Поле должно быть заполнено', 'alias' => 'Username'], ...]
```

License
-------

[](#license)

This project is licensed under the **Mozilla Public License 2.0 (MPL-2.0)** — a free, open-source license that:

- Requires preservation of copyright and license notices,
- Allows commercial and non-commercial use,
- Requires that any modifications to the original files remain open under MPL-2.0,
- Permits combining with proprietary code in larger works.

📄 Full license text: [LICENSE](./LICENSE)
🌐 Official MPL-2.0 page:

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance94

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

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

Recently: every ~0 days

Total

12

Last Release

42d ago

Major Versions

v2.0.0 → v25.62025-06-25

v25.12 → v26.12025-12-30

PHP version history (3 changes)v2.0.0PHP &gt;=7.1

v25.6PHP &gt;=8.3

v26.7.1PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/75e65761bdd94035d1c783773a706d5722ce3164fe55d9722581c2cb4a642d8c?d=identicon)[jagepard](/maintainers/jagepard)

---

Top Contributors

[![Jagepard](https://avatars.githubusercontent.com/u/4591345?v=4)](https://github.com/Jagepard "Jagepard (158 commits)")

---

Tags

rudravalidationvalidation-libraryvalidatorvalidatorvalidationrudravalidation library

### Embed Badge

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

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

###  Alternatives

[respect/validation

The most awesome validation engine ever created for PHP

6.0k40.8M429](/packages/respect-validation)[opis/json-schema

Json Schema Validator for PHP

65446.2M362](/packages/opis-json-schema)[vlucas/valitron

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

1.6k4.7M143](/packages/vlucas-valitron)[intervention/validation

Additional validation rules for the Laravel framework

6837.4M22](/packages/intervention-validation)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.4M50](/packages/proengsoft-laravel-jsvalidation)[wixel/gump

A fast, extensible &amp; stand-alone PHP input validation class that allows you to validate any data.

1.2k1.4M34](/packages/wixel-gump)

PHPackages © 2026

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