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

ActiveLibrary

romagny13/php-validator
=======================

Simple Php Validator

0.1.0(9y ago)018PHP

Since May 7Pushed 9y ago1 watchersCompare

[ Source](https://github.com/romagny13/php-validator)[ Packagist](https://packagist.org/packages/romagny13/php-validator)[ RSS](/packages/romagny13-php-validator/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

PHP Validator
=============

[](#php-validator)

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

[](#installation)

```
composer require romagny13\php-validator

```

Presentation
------------

[](#presentation)

**Validation classes** (extends Validation base class) =&gt; with message (error message) and \_\_invoke (magic function) to validate the received value:

- RequiredValidation
- MinLengthValidation
- MaxLengthValidation
- PatternValidation
- EmailValidation
- CustomValidation

**Services**:

- **ValidationStrategy** (implements ValidationStrategyInterface) =&gt; returns Validation class instances (RequiredValidation, MinLengthValidation, etc.)
- **ValidationService** (implements ValidationServiceInterface) =&gt; allows to register validations by models and validate model values

**Helpers**:

- **Validations** =&gt; Provides shortcuts (static functions) to create instances of Validations (**required**, **minLength**, **maxLength**, **pattern**, **email**, **custom**)
- **Validator** =&gt; Allows to validate easily (static functions) a model with validations (**valide model** and **validateValue**)

Example
-------

[](#example)

```
