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

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

memio/validator
===============

Memio's validator, used to check built models again a pre-defined set of rules

v3.0.2(3mo ago)3311.1k↓33.3%15MITPHPPHP ^7.2 || ^8.0CI passing

Since Apr 16Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/memio/validator)[ Packagist](https://packagist.org/packages/memio/validator)[ Docs](http://memio.github.io/memio)[ RSS](/packages/memio-validator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (16)Used By (5)

Memio's Validator
=================

[](#memios-validator)

A validator library for Memio: allows to define `Constraints` to check if the built [Memio models](http://github.com/memio/model) are valid (e.g. `Method` cannot be both abstract and final).

> **Note**: This package is part of [Memio](http://memio.github.io/memio), a highly opinionated PHP code generator. Have a look at [the main repository](http://github.com/memio/memio).

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

[](#installation)

Install it using [Composer](https://getcomposer.org/download):

```
$ composer require memio/validator:^3.0
```

Example
-------

[](#example)

Let's say we want to check that `Arguments` aren't scalar. In order to do so, the first thing we'll need to do is to write a `Constraint`:

```
