1. Go to this page and download the library: Download volcanus/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/ */
volcanus / validation example snippets
use Volcanus\Validation\Context;
use Volcanus\Validation\Checker\IntChecker;
use Volcanus\Validation\Exception\CheckerException;
use Volcanus\Validation\Exception\CheckerException\IntException;
use Volcanus\Validation\Exception\CheckerException\MinValueException;
use Volcanus\Validation\Exception\CheckerException\MaxValueException;
$checker = new IntChecker();
try {
$checker->check('foo', ['min' => 1, 'max' => 10]);
} catch (IntException $e) {
die('数値を入力してください');
} catch (MinValueException $e) {
die('1以上の数値を入力してください');
} catch (MaxValueException $e) {
die('10以下の数値を入力してください');
}