PHP code example of forestry / form-validator

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

    

forestry / form-validator example snippets


$validator = new Forestry\FormValidator\Validator();

$rules = [
    'name' => 'alpha|

$validator->validate($_POST, $rules);

if ($validator->hasErrors()) {
    $errors = $validator->getErrors();
}

Forestry\FormValidator\Validator::error('confirm_password', '<span class="text-danger">{message}</span>');

$rules['password'] = 'ord'] = 'same:password';

$rules['tos'] = "

use Forestry\FormValidator\SimpleRuleInterface;

MyRule implements SimpleRuleInterface
{
    public function validate($value)
    {
        // Your code.
    }
    
    public function getMessage($value)
    {
        // Your code.
    }
}

$validator->registerRule('myrule', '\MyRule');

$validator->updateRule('url', '\MyRule');