/assert

Declarative validator for PHP 7

Primary LanguagePHPMIT LicenseMIT

Assert

Build Status Code Climate

Declarative validator for PHP 7. Inspired by Respect/Validation.

Example

<?php declare(strict_types=1);

namespace MyNamespace;

use Acelot\Assert\Rule\{
    AllOf,
    StringType,
    MinLength,
    MaxLength
};

$v = new AllOf(
    new StringType(),
    new MinLength(3),
    new MaxLength(256)
);

$v->assert(1); // throws a AllOfException
$v->assert('asd'); // pass