azi/envalid
Composer 安装命令:
composer require azi/envalid
包简介
Server side data/form validation library
README 文档
README
Envalid is a framework agnostic and fluent server side form validation package for PHP
Documentation
Installation
Envalid can be installed via composer just execute the following command
in your project root
composer require azi/envalid
Or add the following in your composer.json file and run composer install
"require": {
"azi/envalid": "^1.0"
}
Usage
Using envalid in your project is super simple, here is an example
$validator = new azi\Validator(); $validator->validate($_POST, [ 'username' => 'required', 'password' => 'required|password:strong', 'confirm_password' => 'required|same:password' ]);
If you've files to validate you will need to merge $_POST|$_GET and with $_FILES just like the following
$validator = new azi\Validator(); $validator->validate(array_merge($_POST, $_FILES), [ 'profile_picture' => 'file:image' ]);
Available Rules
- required
- password
Accepts password strength like password:strong|medium|normal (default noraml) - number
- file
Accepts file type currently supported formats: image,video,doc - min
- max
- length
- array
- boolean
- ip
- same
- alpha
- alnum
Contributions
This repository is maintained by @azeemhassni
If you can contribute I'd love to merge your PR and your name will be mentioned in the release notes and contributors list.
统计信息
- 总下载量: 202
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 24
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-04-02