ailixter/gears-filter
Composer 安装命令:
composer require ailixter/gears-filter
包简介
The project, which gears Filter functions.
README 文档
README
The project, which gears Filter functions.
Casts
- variable
- input GET, POST, etc.
- array
Cast $var into $type.
$filter = new Filter; $int1 = $filter->cast(FILTER_VALIDATE_INT, '123'); $int2 = $filter->cast(['filter'=>FILTER_VALIDATE_INT, 'flags'=>...], '123'); $int3 = $filter->cast('int', '123');
Cast input $key into $type.
$filter = new Filter; $int1 = $filter->castInput(FILTER_VALIDATE_INT, INPUT_POST, 'p'); $int2 = $filter->castInput(['filter'=>FILTER_VALIDATE_INT, 'flags'=>...], INPUT_POST, 'p'); $int3 = $filter->castInput('int', INPUT_POST, 'p');
Utility Filter-based class ArrayFilter
$array = new ArrayFilter(['a' => 123, 'b' => 'false'], new Filter); $bool = $array->get('bool', 'b'); $float = $array->getFloat('a', 0.0); $custom = $array->getCustomType('a'); $all = $array->castAll(['a' => 'float', 'b' => 'bool', 'undefined' => 'str']);
Utility Filter-based class InputFilter
$post = new InputFilter(INPUT_POST, new Filter); $bool = $post->get('bool', 'b'); $float = $post->getFloat('a', 0.0); $custom = $post->getCustomType('a'); $all = $post->castAll(['a' => 'float', 'b' => 'bool', 'undefined' => 'str']);
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-21