Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/memcrab/validator
PHP Validator Based on Another Validator
https://github.com/memcrab/validator
Last synced: about 2 months ago
JSON representation
PHP Validator Based on Another Validator
- Host: GitHub
- URL: https://github.com/memcrab/validator
- Owner: Memcrab
- License: apache-2.0
- Created: 2021-07-23T13:10:55.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-24T15:02:16.000Z (over 3 years ago)
- Last Synced: 2024-03-26T18:22:45.878Z (10 months ago)
- Language: PHP
- Size: 19.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PHP Validator as Composer Library
==========================Install
--------
```composer require memcrab/validator```Dependencies
--------
```
- psr/log: "^1.0"
- respect/validation: "^2.1"
```Usage
--------
```php
use Memcrab\Validator\Validator;
use Respect\Validation\Validator as v;class Auth extends Validator
{public function authorization()
{
$this
->addBodyRule('email', v::email(), 'Email not valid', 400101)
->addBodyRule('password', v::length(8, 100), 'Password should be more than 8 symbols', 400102);
}
}
```
```php
authorization();
$Validator->validate();
} catch (ValidatorException $error) {
// handle validation error
}```
---
**MIT Licensed**