charlottedunois/validator

This package is abandoned and no longer maintained. No replacement package was suggested.

PHP Validator for stuff.

v0.3.1 2019-01-15 17:31 UTC

This package is auto-updated.

Last update: 2020-04-17 19:14:29 UTC


README

This is a PHP validator for stuff.

Usage

Include composer's autoloader and initialize an instance.

<?php
// include autoloader

//This one will not fail
$nofail = CharlotteDunois\Validation\Validator::make(
    array(
        'username' => 'CharlotteDunois',
        'email' => 'noreply@github.com'
    ),
    array(
        'username' => 'string|required|min:5|max:75',
        'email' => 'email'
    )
);

var_dump($nofail->passes());

//This one will fail due to invalid email
$fail = CharlotteDunois\Validation\Validator::make(
    array(
        'username' => 'CharlotteDuois',
        'email' => 'noreply@githubcom'
    ),
    array(
        'username' => 'string|required|min:5|max:75',
        'email' => 'email'
    )
);

var_dump($fail->passes(), $fail->errors());

Documentation

https://charlottedunois.github.io/Validator/