php - What is the best generic class or package to use for input validation? -
what best, secured , user-friendly easy use validator class or plugin can use in php coding validate common user inputs e-mail addresses, urls, integers, etc.?
e.g. http://code.google.com/p/owasp-esapi-php/. there better way?
or using filter_input
best way? e.g.
$value = filter_input(input_get, "value", filter_validate_int, array("options" => array("min_range" => 15, "max_range" => 20)));
or custom coding? e.g.
if (isset($_get["value"])) { $value = $_get["value"]; } else { $value = false; } if (is_numeric($value) && ($value >= 15 && $value <= 20)) { // run code } else { // handle issue }
any expert views on this? prefer lazy style, like:
filer_input($post);
is there that?
if you're not familiar such libraries may not user- (developer-) friendly, think should @ symfony2 validator component
. installed throught composer, can used standalone , has excellent documentation here: http://symfony.com/doc/current/book/validation.html , github repository can found here: https://github.com/symfony/validator .
Comments
Post a Comment