PHP code example of frangeris / simple-validation

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

    

frangeris / simple-validation example snippets





/*
|--------------------------------------------------------------------------
| Secure validations
|--------------------------------------------------------------------------
| Here you need to define the rules of each form that you want to validate, 
| each index represent a form <form_name>, followed by an associative 
| array with the fields that contains; each field will have [ email or username for begin',
				'on_filter' => 'Invalid email, please try another'
			)			
		),

		'f_name' => array(
			'e is too long',
				'on_regex' => 'Invalid user name, please try again'
			)
		),

		'age' => array(
			'




use Simple\Validation\Validator;

class ApplicationController extends \Phalcon\Mvc\Controller
{
	public function addAction()
	{
		if($this->request->isPost())
		{
			$request = $this->request->getPost();

			// Here make the trick for pass the rules
    		$validator = Validator::getInstance(with messages just call
			print_r($validator->getErrors());
		}
	}	
}