PHP code example of izica / phalcon-validation

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

    

izica / phalcon-validation example snippets


use Izica\Validation;
use Izica\ValidationRule;
use Phalcon\Mvc\Controller;

class ExampleController extends Controller {
    public function indexAction() {
        $validation = new Validation([
            'email' => [ValidationRule::ccess
    }
    // or short
    public function indexAction() {
        $arMessages = Validation::make($_POST, [
            'email' => [ValidationRule::


/*
    $_POST = [
        'email' => 'qwe'
    ];
*/
$arMessages = $validation->validate($_POST);

/* 
$arMessages
Array
(
    [0] => Array
        (
            [field] => email
            [type] => email
            [message] => email is not valid
        )

    [1] => Array
        (
            [field] => num
            [type] =>