PHP code example of 7csn / utils-validation-type
1. Go to this page and download the library: Download 7csn/utils-validation-type 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/ */
7csn / utils-validation-type example snippets
use chaser\utils\validation\Type;
use InvalidArgumentException;
// 判断数值类型是否无效
Type::invalid($value, int $type, array &$declarations = []): bool;
// 验证数值类型(未通过抛出异常)
Type::validate(string $name, $value, int $type): void;
// 类型异常
Type::exception(string $name, string $declaration): InvalidArgumentException;