PHP code example of kshabazz / whip-lash

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

    

kshabazz / whip-lash example snippets


$validation = (new Validation())
    ->withMessages([ // These keys DO NOT have to match input keys.
       'fname' => 'name must be between 1-26 chars.',
       'fname_re' => 'can only contain spaces & letters.'
   ])
    ->withInput[
       'fnname' => 'First',
   ]);

$validation->assert('first_name')
    ->length(1, 26, 'fname')
    ->regExp('/^[a-zA-Z]+$/', 'fname_re);

$errors = $validation->getErrors();

use \Whip\Lash\Validators\Strings;

class FormValidation extents Validator
{
    use Strings; 
}