bigpaulie/dynamic-form-validation
Composer 安装命令:
composer require bigpaulie/dynamic-form-validation
包简介
PHP Dynamic form validation
README 文档
README
This is a simple PHP library for dynamic form validation. It was written with my own needs in mind, it may not be the best library but it does the job for me.
Installation
Install the package via composer using :
composer require --prefer-dist bipaulie/dynamic-form-validation
Usage
First you should get an instance for the validator, pass it the rules array and data to be validated.
$rules = ['/input_name_([0-9]+)/i' => 'filter_name'];
$validator = new Validator();
$validator->setRules($rules)->setRequest($request);
try {
if ( $validator->run() ) {
echo "Validation successful.";
} else {
echo "Validation failed.";
}
} catch ( \Exception $e ) {
echo $e->getMessage();
}
Available filters
String validation
The "string" filter validates strings of characters containging : letters, numbers, spaces, dots and hyphens.
Date validation
The "date" filter validates dates of the follwing formats :
* d/m/Y
* m/d/Y
* d/m/y
* m/d/y
Email validation
The "email" filter validates email addresses
Numeric validation
The "numerical" filter validates numerical values such as integers and floats
Password validation
The "password" filter validates passwords of the following format:
- Has at least one uppercase letter
- Has at least one number
- Has at least one special character (!,@,#,$)
- Is at least 8 characters long
Examples
Checkout the examples directory form some examples on how to use the validator.
Contribution
If you like the library and you feel like something is missing or fix a potential bug, please feel free to submit a pull request, if I like your idea or it's useful I will merge it with the repository.
A final note about this library. I'm using "git flow" to manage this repository, the main branch here is called "develop" not master.
Thank you for using and contributing.
bigpaulie/dynamic-form-validation 适用场景与选型建议
bigpaulie/dynamic-form-validation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 07 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bigpaulie/dynamic-form-validation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bigpaulie/dynamic-form-validation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-30