logadapp/validator
最新稳定版本:v0.0.1
Composer 安装命令:
composer require logadapp/validator
包简介
Request Validation library
README 文档
README
LogadApp\Validator
About The Project
Features
- Simple to use
- Supports underscores and camelcase (file_size or fileSize)
- Easy to create your own rules
- File validation
- Min\Max length validation
- Email validation
- File size validation
- Conditional requirements
- Similar to Laravel's validation feature
- Inspired by Rakit\Validation
Installation
How to install.
- Using composer
composer require logadapp/validator
- Include the generated autoload in your file, See index.php for example
Usage
<?php use LogadApp\Validator\Validation; require('vendor/autoload.php'); $validator = new Validation; $rules = [ 'test' => 'required|numeric|max:10|min:5', 'text' => 'required|maxLength:5|minLength:3', 'email' => 'required|email', 'type' => 'required|in:user,admin', 'name' => 'requiredIf:type,user,admin', 'profilePic' => 'file|requiredIf:type,user,admin|fileSize:10KB|fileType:jpg,png,jpeg', ]; $validator->make($_POST, $_FILES, $rules); $validator->validate();
OR Validate directly
$validator->validate($_POST, $_FILES, $rules);
Built With
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch
- Commit your Changes
- Push to the Branch
- Open a Pull Request
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-09