Respect / Validation

The most awesome validation engine ever created for PHP
https://respect-validation.readthedocs.io
MIT License
5.8k stars 774 forks source link

Create shortcuts classes #859

Closed henriquemoody closed 5 years ago

henriquemoody commented 7 years ago

In order to make simple validations even shorter, create the classes: Assert, Check, and IsValid.

Usage examples:

// Validator::email()->validate($input)
IsValid::email($input);

// Validator::not(Validator::email())->validate($input)
IsValid::notEmail($input);

// Validator::email()->assert($input)
Assert::email($input);

// Validator::not(Validator::email())->assert($input)
Assert::notEmail($input);

// Validator::assert() with custom template
Assert::email($input, 'Template message with {{input}}');

// Validator::email()->check($input)
Check::email($input);

// Validator::not(Validator::email())->check($input)
Check::notEmail($input);

// Validator::check() with custom template
Check::email($input, 'Template message with {{input}}');

// Validator::check() against multiple inputs
Check::emailAll($input);
Check::emailAny($input);
Check::emailNone($input);
sunchayn commented 5 years ago

still relevant ?

henriquemoody commented 5 years ago

No, I created Assertion to do some of it. For the rest, I think they would make more sense outside this library.

Thanks for bringing my attention to it! 🐼