PHP code example of ksfraser / validation

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

    

ksfraser / validation example snippets


use Ksfraser\Validation\Assert;

Assert::notEmptyString($bankAccountNumber, 'bankAccountNumber');
Assert::stringMaxLen($bankAccountNumber, 255, 'bankAccountNumber');

use Ksfraser\Validation\Traits\ValidatesStringTrait;

final class Example
{
    use ValidatesStringTrait;

    public function setCode($code)
    {
        $this->assertNotEmptyString($code, 'code');
        $this->assertStringMaxLen($code, 20, 'code');
    }
}