PHP code example of jijihohococo / ichi-validation

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

    

jijihohococo / ichi-validation example snippets



composer 


use JiJiHoHoCoCo\IchiValidation\Validator;

$validator=new Validator();
$boolResult=$validator->validate($_REQUEST,[
	'name' => ' //

$errorMessages=$boolResult==FALSE ? $validator->getErrors() : []; 



$validator->validate($_REQUEST,[
	'name' => '


$validator->validate($_REQUEST,[
	'age' => 'integer'
]);



$validator->validate($_REQUEST,[
	'phone' => 'string'
])



$validator->validate($_REQUEST,[
	'married' => 'bool'
]);



$validator->validate($_REQUEST,[
	'weight' => 'double'
]);



$validator->validate($_REQUEST,[
	'highlights' => 'array'
]);



$validator->validate($_REQUEST,[
	'email' => 'email'
]);



$validator->validate($_REQUEST,[
	'image' => 'file'
]);



$validator->validate($_REQUEST,[
	'image' => 'image'
]);



$validator->validate($_REQUEST,[
	'password' => 'confirmed'
]);



$validator->validate($_REQUEST,[
	'name' => 'min:10'
]);



$validator->validate($_REQUEST,[
	'age' => 'min:18'
]);



$validator->validate($_REQUEST,[
	'image' => 'min:3'
]);



$validator->validate($_REQUEST,[
	'name' => 'max:10'
]);



$validator->validate($_REQUEST,[
	'age' => 'max:18'
]);



$validator->validate($_REQUEST,[
	'image' => 'max:3'
]);



$validator->setPDO($pdoObject);



$validator->validate($_REQUEST,[
	'email' => 'unique:user_table,email_field,NULL'
]);



$validator->validate($_REQUEST,[
	'email' => 'unique:user_table,email_field,'.NULL
]);



$validator->validate($_REQUEST,[	
	'email' => 'unique:user_table,email_field,'. 1
]);



$validator->validate($_REQUEST,[
	'email' => 'unique:user_table,email_field,'. 1.',user_id'
]);



$validator->validate($_REQUEST,[
	'image' => 'mime:png,jpg,jpeg,gif'
]);



$validator->validate($_REQUEST,[
	'age' => 'between:18,25'
]);



$validator->validate($_REQUEST,[
	'image' => 'dimensions:width=100' 
]);



$validator->validate($_REQUEST,[
	'image' => 'dimensions:min_width=100'
]);



$validator->validate($_REQUEST,[
	'image' => 'dimensions:max_width=100'
]);



$validator->validate($_REQUEST,[
	'image' => 'dimensions:height=100'
]);



$validator->validate($_REQUEST,[
	'image' => 'dimensions:min_height=100'
]);



$validator->validate($_REQUEST,[
	'image' => 'dimensions:max_height=100'
]);



$validator->validate($_REQUEST,[
	'image' => 'dimensions:width=100,height=100'
]);



$validator->validate($_REQUEST,[
	'image' => 'image_ratio:1/3'
]);



$validator->validate($_REQUEST,[
	'name' => '
	'


$validator->validate($_REQUEST,[
	'name' => 'e.

#!/usr/bin/env php


idation\Command\ValidationCommand;


$validationCommand=new ValidationCommand;
$validationCommand->run(__DIR__,$argv);



php ichi make:validation TestValidation



$validationCommand=new ValidationCommand;
$validationCommand->setPath('new_app/Validations');
$validationCommand->run(__DIR__,$argv);



namespace App\Validations;
use JiJiHoHoCoCo\IchiValidation\CustomValidator;

class TestValidation extends CustomValidator{


	public function __construct(){


	}


	public function rule(){

		return $this->value>21;
	}


	public function showErrorMessage(){

		return 'Your ' .$this->attribute . ' should be over 21.';

	}


}


use App\Validations\TestValidation;

$validator=new Validator;
$validator->validate($_REQUEST,[
	'name' => '


$this->attribute



$this->value

txt

your_project/vendor/jijihohococo/ichi-validation > php test/index.php 

array
file