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

Abandoned → [selective/validation](/?search=selective%2Fvalidation)Library[Validation &amp; Sanitization](/categories/validation)

odan/validation
===============

Validation error collector and transformer

2.0.0(4y ago)35335MITPHPPHP ^7.2 || ^8.0CI failing

Since Apr 18Pushed 3w ago4 watchersCompare

[ Source](https://github.com/odan/validation)[ Packagist](https://packagist.org/packages/odan/validation)[ RSS](/packages/odan-validation/feed)WikiDiscussions master Synced 4d ago

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

Validation
==========

[](#validation)

A validation library for PHP that uses the [notification pattern](https://martinfowler.com/articles/replaceThrowWithNotification.html).

[![Latest Version on Packagist](https://camo.githubusercontent.com/83aef21616b0fb3094540b69ad3539ce25e628f49af19ea2c2ec79edb4c627eb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73656c6563746976652d7068702f76616c69646174696f6e2e737667)](https://packagist.org/packages/selective/validation)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![Build Status](https://github.com/selective-php/validation/workflows/build/badge.svg)](https://github.com/selective-php/validation/actions)[![Total Downloads](https://camo.githubusercontent.com/b1296d15210eb0a3cb2781d3512e66f568ff3eb81f8a34415b183c359d476652/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73656c6563746976652f76616c69646174696f6e2e737667)](https://packagist.org/packages/selective/validation/stats)

Table of contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
    - [Validating form data](#validating-form-data)
    - [Validating JSON](#validating-json)
    - [Regex](#regex)
- [Validators](#validators)
    - [CakePHP Validator](#cakephp-validator)
- [Transformer](#transformer)
- [License](#license)

Requirements
------------

[](#requirements)

- PHP 8.2 - 8.5

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

[](#installation)

```
composer require selective/validation
```

Usage
-----

[](#usage)

> A notification is a collection of errors

In order to use a notification, you have to create the `ValidationResult` object. A `ValidationResult` can be really simple:

```
