mouf / utils.common.validators
This package contains typical validators to be used in your application. A validator is a class that decides whether a string is valid or not. For instance, you could use an EmailValidator to validate that a string is a mail, etc...
Installs: 162 452
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 1
Open Issues: 0
Type:mouf-library
Requires
- php: >=5.3.0
- mouf/utils.i18n.fine: >=3.0-dev,<4.0
README
This package contains typical validators to be used in your application.
A validator is a class that decides whether a string is valid or not and implements the ValidatorInterface
.
The ValidatorInterface
is part of this package.
For instance, you could use an EmailValidator
to validate that a string is a mail, etc...
List of embedded validators
RequiredValidator
: validates a value is not emptyNumericValidator
: validates a value is a number (optionnally an integer)EmailValidator
: validates an email addressURLValidator
: validates a URL (starting with http://, https:// or ftp://)MaxMinRangeValidator
: validates a value is between 2 boundsMaxMinRangeLengthValidator
: validates a string length is between 2 boundsSiretValidator
: validates a value is a valid SIRET number (French company id)
Javascript validation
If the validator implements the JsValidatorInterface
, it provides the code to be run both in PHP and in Javascript.
This means you can use this validator to generate Javascript code that validates any value.
I18n
The validators in the packet rely in Fine for translating validation error messages.