https://github.com/azeemhassni/envalid
Envalid is a framework agnostic and fluent server side form validation package for PHP
https://github.com/azeemhassni/envalid
form-validation laravel-like php serverside validation
Last synced: 4 months ago
JSON representation
Envalid is a framework agnostic and fluent server side form validation package for PHP
- Host: GitHub
- URL: https://github.com/azeemhassni/envalid
- Owner: azeemhassni
- License: mit
- Created: 2017-03-27T14:47:35.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-05-04T13:25:00.000Z (about 3 years ago)
- Last Synced: 2025-05-18T00:40:19.324Z (about 1 year ago)
- Topics: form-validation, laravel-like, php, serverside, validation
- Language: PHP
- Homepage: http://envalid.azeemhassni.com
- Size: 371 KB
- Stars: 24
- Watchers: 6
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# Envalid
**Envalid** is a framework agnostic and fluent server side form validation package for PHP
[](https://travis-ci.org/azeemhassni/envalid)
# [Documentation](http://envalid.azeemhassni.com/docs.html)
# 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
```php
$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
```php
$validator = new azi\Validator();
$validator->validate(array_merge($_POST, $_FILES), [
'profile_picture' => 'file:image'
]);
```
# Available Rules
- required
- email
- 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](https://github.com/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.