PHP code example of yiiy / argus

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

    

yiiy / argus example snippets




i\Argus\Validator;

$data = [
    'name'  => 'John Doe',
    'email' => 'invalid_email',
    'age'   => 30,
];

$rules = [
    'name'  => ['ator->validate($data, $rules);

if (empty($errors)) {
    echo 'Data is valid!';
} else {
    echo 'Validation errors:' . PHP_EOL;
    foreach ($errors as $field => $errorMessages) {
        echo "  * $field: " . implode(', ', $errorMessages) . PHP_EOL;
    }
}