PHP code example of mahdyaslami / simple-validation

1. Go to this page and download the library: Download mahdyaslami/simple-validation 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/ */

    

mahdyaslami / simple-validation example snippets




$validator = new ObjectRule([
    new RequiredRule('id', [new IntegerRule(), new LowerRule(5)]),
    new SometimesRule('data', [new ArrayRule([
        new IntegerRule()
    ])]);
]);

$validator->validate($value);



$validator = objectWith([
        integer()
    ]))
]);