Good PHP validation libraries

I am trying to find a list of good verification libraries (phone, email, etc.) that are constantly maintained. I use PHP and open libraries from frameworks, but if you recommend a library from a framework, tell me if it allows using it without the structure itself?

+3
source share
5 answers

You can give Zend_Validate

http://framework.zend.com/manual/en/zend.validate.introduction.html

With the Zend framework, you can use any part of the structure that you like. If you move on to a very simple check, it can be as simple as static calls for predefined methods, such as:

if (Zend_Validate::is($email, 'EmailAddress')) {
    // Yes, email appears to be valid
}

.

+6
+4

PEAR Validate .

+2

Respect\Validation ​​ , . , () , 80 ( ) .

. :

use Respect\Validation\Validator as v;
$number = 123;
v::numeric()->validate($number); //true

. :

use Respect\Validation\Validator as v;
$usernameValidator = v::alnum()->noWhitespace()->length(1,15);
$usernameValidator->validate('alganet'); //true

.

Github .

+2

Source: https://habr.com/ru/post/1764588/


All Articles