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() : [];
#!/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' => '