amattu2/php-filter
最新稳定版本:v1.0.0
Composer 安装命令:
composer require amattu2/php-filter
包简介
A basic PHP input filter and validation class.
README 文档
README
This is a PHP class which implements static methods to filter/format unsanitized user input. See below for usage examples and cases. Alternatively, take a look at the index.php file for further examples.
Usage
Include the /src/Filter.php file
require(dirname(__FILE__) . "/src/Filter.php");
Methods
Filter::*input*(string $var)
Remove unprintable characters, HTML entities, and slashes.
Filter::*nonNumeric*(int|string|double|float $var)
Remove non-numeric characters
Filter::*nonAlpha*(mixed $var)
Remove non-alpha (a-zA-Z) characters
Filter::*nonAlphaNumeric*(mixed $var)
Remove non-alphanumeric (a-zA-Z0-9) characters
Filter::*fileName*(string $var)
Replace whitespace characters with a dash (-)
Filter::*number*(int|string $var)
Format a 10 digit phone number (XXX-XXX-XXXX)
Notes
You should always use prepared statements and proper validation on all unsafe input, regardless of using this class or not.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0
- 更新时间: 2023-03-09