background preloader

Library

Facebook Twitter

PHP software. PHPMailer/PHPMailer. Swiftmailer/swiftmailer. Validation. The most awesome validation engine ever created for PHP. Complex (custom) rules made simple: v::numeric()->positive()->between(1, 256)->validate($myNumber).Awesome (customizable, iterable) exceptions.80 (fully tested) validators. Installation Packages available on PEAR and Composer. Autoloading is PSR-0 compatible. Feature Guide Namespace Import Respect\Validation is namespaced, but you can make your life easier by importing a single class into your context: use Respect\Validation\Validator as v; Simple Validation The Hello World validator is something like this: $number = 123; v::numeric()->validate($number); Chained Validation It is possible to use validators in a chain.

$usernameValidator = v::alnum()->noWhitespace()->length(1,15); $usernameValidator->validate('alganet'); Validating Object Attributes Given this simple object: $user = new stdClass; $user->name = 'Alexandre'; $user->birthdate = '1987-07-01'; Is possible to validate its attributes in a single chain: Input optional Negating Rules Message: Hoa, un ensemble de bibliothèques PHP. Eden PHP Library. Openovate/eden Git Repo.