PHP code example of manzowa / manzowa-validator

1. Go to this page and download the library: Download manzowa/manzowa-validator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

manzowa / manzowa-validator example snippets


 
    $validator = new Monzowa\Validator\Validator;

    if ($validator->method()) {
        $validator->validate(
            [
                "numero" => function () {
                    Validator::isEmpty()->isNumber()->get();
                },
                "code" => function () {
                    Validator::isEmpty()->isNumber()->size(4)->get();
                },
                "email" => function () {
                    Validator::isEmpty()->get();
                },
                "confirm_email" =>  function () {
                    Validator::isEmpty()->same("email")->get();
                },
                "password" => function () {
                    Validator::isEmpty()->get();
                },
                "confirm_password" => function () {
                    Validator::isEmpty()->get();
                }
            ]
        );
        if ($validator->failed()) {
            echo "<pre>";
            print_r($validator->errors());
            echo "</pre>";
        } else {
            echo "<pre>";
            print_r($validator->results());
            echo "</pre>";
        }
    }