PHP code example of obsidian / validation

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

    

obsidian / validation example snippets


use Obsidian\Validation\Validator;

$validator = Validator::make(
    array(
        'username' => 'string|=> 'github',
    'email' => '[email protected]'
))); // bool(true)

// fails
$validator->validate(array(
    'username' => 5,
    'email' => '[email protected]'
)); // throws InvalidArgumentException