PHP code example of frbit / validator-loader

1. Go to this page and download the library: Download frbit/validator-loader 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/ */

    

frbit / validator-loader example snippets

 bash
$ php composer.phar 
 php


use \Frbit\ValidatorLoader\Factory;

$loader = $loader = Factory::fromArray(array(
    'variables' => array(
        'FOO' => '/foo/',
        'bar' => 5
    ),
    'validators' => array(
        'my-form' => array(
            'rules' => array(
                'email' => array(
                    'min:10',
                    'max:<<bar>>'
                )
            ),
            'messages' => array(
                'email.min' => 'Too short',
                'email.max' => 'Too long'
            )
        )
    )
));
 php

// ..
$loader->setMethod('foo', 'FooValidator@validate');