intro
A reference about standard validators of Zend Framework.
- Zend_Validate_Alnum
- Zend_Validate_Alpha
- Zend_Validate_Barcode
- Zend_Validate_Between
- Zend_Validate_Ccnum
- Zend_Validate_Date
- Zend_Validate_EmailAddress
- Zend_Validate_Float
- Zend_Validate_GreaterThan
- Zend_Validate_Hex
- Zend_Validate_Hostname
- Zend_Validate_Identical
- Zend_Validate_InArray
- Zend_Validate_Int
- Zend_Validate_Ip
- Zend_Validate_LessThan
- Zend_Validate_NotEmpty
- Zend_Validate_Regex
- Zend_Validate_StringLength
- An example of message file(TXT Format)
This class validates $value is alphabet or number.
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 |
/** * Sets default option values for this instance * * @param boolean $allowWhiteSpace * @return void */ public function __construct($allowWhiteSpace = false) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notAlnum | ‘%value%’ has not only alphabetic and digit characters |
stringEmpty | ‘%value%’ is an empty string |
This class validates $value is alphabet.
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 |
/** * Sets default option values for this instance * * @param boolean $allowWhiteSpace * @return void */ public function __construct($allowWhiteSpace = false) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notAlpha | ‘%value%’ has not only alphabetic characters |
stringEmpty | ‘%value%’ is an empty string |
This class validates $values is barcode format.
Following is about the constructer.
(‘upc’ or ‘ean13’ can be used as the parameter $barcodeType)
Following is about the error messages(UPC-A).
Following is about the constructer.
(‘upc’ or ‘ean13’ can be used as the parameter $barcodeType)
1 2 3 4 5 6 7 8 |
/** * Generates the standard validator object * * @param string $barcodeType - Barcode validator to use * @return void * @throws Zend_Validate_Exception */ public function __construct($barcodeType) |
Following is about the error messages(UPC-A).
Error Message Key | Initial Error Message |
---|---|
invalid | ‘%value%’ is an invalid UPC-A barcode |
invalidLength | ‘%value%’ is an invalid UPC-A barcode |
Following is about the error messages(EAN-13).
Error Message Key | Initial Error Message |
---|---|
invalid | ‘%value%’ is an invalid EAN-13 barcode |
invalidLength | ‘%value%’ should be 13 characters |
This class validates $value is between $min and $max.
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 8 9 |
/** * Sets validator options * * @param mixed $min * @param mixed $max * @param boolean $inclusive * @return void */ public function __construct($min, $max, $inclusive = true) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notBetween | ‘%value%’ is not between ‘%min%’ and ‘%max%’, inclusively |
notBetweenStrict | ‘%value%’ is not strictly between ‘%min%’ and ‘%max%’ |
This class validates $value follows Luhn algorithm (mod-10 checksum) credit card numbers.
This class has no constructer.
Following is about the error messages.
This class has no constructer.
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
ccnumLength | ‘%value%’ must contain between 13 and 19 digits |
ccnumChecksum | Luhn algorithm (mod-10 checksum) failed on ‘%value%’ |
This class validates $value is a valid date of the specified format(default YYYY-MM-DD).
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 8 |
/** * Sets validator options * * @param string $format OPTIONAL * @param string|Zend_Locale $locale OPTIONAL * @return void */ public function __construct($format = null, $locale = null) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
dateNotYYYY-MM-DD | ‘%value%’ is not of the format YYYY-MM-DD |
dateInvalid | ‘%value%’ does not appear to be a valid date |
dateFalseFormat | ‘%value%’ does not fit given date format |
This class validates $value only contains digit characters.
This class has no constructer.
Following is about the error messages.
This class has no constructer.
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notDigits | ‘%value%’ contains not only digit characters |
stringEmpty | ‘%value%’ is an empty string |
This class validates $value is a valid email address.
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
/** * Instantiates hostname validator for local use * * You can pass a bitfield to determine what types of hostnames are allowed. * These bitfields are defined by the ALLOW_* constants in Zend_Validate_Hostname * The default is to allow DNS hostnames only * * @param integer $allow OPTIONAL * @param bool $validateMx OPTIONAL * @param Zend_Validate_Hostname $hostnameValidator OPTIONAL * @return void */ public function __construct($allow = Zend_Validate_Hostname::ALLOW_DNS, $validateMx = false, Zend_Validate_Hostname $hostnameValidator = null) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
emailAddressInvalid | ‘%value%’ is not a valid email address in the basic format local-part@hostname |
emailAddressInvalidHostname | ‘%hostname%’ is not a valid hostname for email address ‘%value%’ |
emailAddressInvalidMxRecord | ‘%hostname%’ does not appear to have a valid MX record for the email address ‘%value%’ |
emailAddressDotAtom | ‘%localPart%’ not matched against dot-atom format |
emailAddressQuotedString | ‘%localPart%’ not matched against quoted-string format |
emailAddressInvalidLocalPart | ‘%localPart%’ is not a valid local part for email address ‘%value%’ |
This class validates $value is a floating-point value.
This class has no constructer.
Following is about the error messages.
This class has no constructer.
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notFloat | ‘%value%’ does not appear to be a float |
This class validates $value is greater than $min.
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 |
/** * Sets validator options * * @param mixed $min * @return void */ public function __construct($min) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notGreaterThan | ‘%value%’ is not greater than ‘%min%’ |
This class validates $value contains only hexadecimal digit characters.
This class has no constructer.
Following is about the error messages.
This class has no constructer.
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notHex | ‘%value%’ has not only hexadecimal digit characters |
This class validates $value is a valid host name.
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
/** * Sets validator options * * @param integer $allow OPTIONAL Set what types of hostname to allow (default ALLOW_DNS) * @param boolean $validateIdn OPTIONAL Set whether IDN domains are validated (default true) * @param boolean $validateTld OPTIONAL Set whether the TLD element of a hostname is validated (default true) * @param Zend_Validate_Ip $ipValidator OPTIONAL * @return void * @see http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm Technical Specifications for ccTLDs */ public function __construct($allow = self::ALLOW_DNS, $validateIdn = true, $validateTld = true, Zend_Validate_Ip $ipValidator = null) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
hostnameIpAddressNotAllowed | ‘%value%’ appears to be an IP address, but IP addresses are not allowed |
hostnameUnknownTld | ‘%value%’ appears to be a DNS hostname but cannot match TLD against known list |
hostnameDashCharacter | ‘%value%’ appears to be a DNS hostname but contains a dash (-) in an invalid position |
hostnameInvalidHostnameSchema | ‘%value%’ appears to be a DNS hostname but cannot match against hostname schema for TLD ‘%tld%’ |
hostnameUndecipherableTld | ‘%value%’ appears to be a DNS hostname but cannot extract TLD part |
hostnameInvalidHostname | ‘%value%’ does not match the expected structure for a DNS hostname |
hostnameInvalidLocalName | ‘%value%’ does not appear to be a valid local network name |
hostnameLocalNameNotAllowed | ‘%value%’ appears to be a local network name but local network names are not allowed |
This class validates $value is same as $token.
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 |
/** * Sets validator options * * @param string $token * @return void */ public function __construct($token = null) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notSame | Tokens do not match |
missingToken | No token was provided to match against |
This class validates $value is contained in array $haystack.
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 8 |
/** * Sets validator options * * @param array $haystack * @param boolean $strict * @return void */ public function __construct(array $haystack, $strict = false) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notInArray | ‘%value%’ was not found in the haystack |
This class validates $value is a valid integer.
This class has no constructer.
Following is about the error messages.
This class has no constructer.
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notInt | ‘%value%’ does not appear to be an integer |
This class validates $value is a valid ip address.
This class has no constructer.
Following is about the error messages.
This class has no constructer.
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notIpAddress | ‘%value%’ does not appear to be a valid IP address |
This class validates $value is less than $max.
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 |
/** * Sets validator options * * @param mixed $max * @return void */ public function __construct($max) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
notLessThan | ‘%value%’ is not less than ‘%max%’ |
This class validates $value is not empty.
This class has no constructer.
Following is about the error messages.
This class has no constructer.
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
isEmpty | Value is empty, but a non-empty value is required |
This class validates $value matches against a regular expression pattern.
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 |
/** * Sets validator options * * @param string $pattern * @return void */ public function __construct($pattern) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
regexNotMatch | ‘%value%’ does not match against pattern ‘%pattern%’ |
This class validates the string length of $value is between $min and $max.
Following is about the constructer.
Following is about the error messages.
Following is about the constructer.
1 2 3 4 5 6 7 8 |
/** * Sets validator options * * @param integer $min * @param integer $max * @return void */ public function __construct($min = 0, $max = null) |
Following is about the error messages.
Error Message Key | Initial Error Message |
---|---|
stringLengthTooShort | ‘%value%’ is less than %min% characters long |
stringLengthTooLong | ‘%value%’ is greater than %max% characters long |
I have not check it… You can download English and Japanese files from here.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
notAlnum;'%value%' has not only alphabetic and digit characters stringEmpty;'%value%' is an empty string notAlpha;'%value%' has not only alphabetic characters invalid;'%value%' is an invalid UPC-A barcode invalidLength;'%value%' is an invalid UPC-A barcode notBetween;'%value%' is not between '%min%' and '%max%', inclusively notBetweenStrict;'%value%' is not strictly between '%min%' and '%max%' ccnumLength;'%value%' must contain between 13 and 19 digits ccnumChecksum;Luhn algorithm (mod-10 checksum) failed on '%value%' dateNotYYYY-MM-DD;'%value%' is not of the format YYYY-MM-DD dateInvalid;'%value%' does not appear to be a valid date dateFalseFormat;'%value%' does not fit given date format notDigits;'%value%' contains not only digit characters emailAddressInvalid;'%value%' is not a valid email address in the basic format local-part@hostname emailAddressInvalidHostname;'%hostname%' is not a valid hostname for email address '%value%' emailAddressInvalidMxRecord ;'%hostname%' does not appear to have a valid MX record for the email address '%value%' emailAddressDotAtom;'%localPart%' not matched against dot-atom format emailAddressQuotedString;'%localPart%' not matched against quoted-string format emailAddressInvalidLocalPart;'%localPart%' is not a valid local part for email address '%value%' notFloat;'%value%' does not appear to be a float notGreaterThan;'%value%' is not greater than '%min%' notHex;'%value%' has not only hexadecimal digit characters hostnameIpAddressNotAllowed;'%value%' appears to be an IP address, but IP addresses are not allowed hostnameUnknownTld;'%value%' appears to be a DNS hostname but cannot match TLD against known list hostnameDashCharacter;'%value%' appears to be a DNS hostname but contains a dash (-) in an invalid position hostnameInvalidHostnameSchema;'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%' hostnameUndecipherableTld;'%value%' appears to be a DNS hostname but cannot extract TLD part hostnameInvalidHostname;'%value%' does not match the expected structure for a DNS hostname hostnameInvalidLocalName;'%value%' does not appear to be a valid local network name hostnameLocalNameNotAllowed;'%value%' appears to be a local network name but local network names are not allowed notSame;Tokens do not match missingToken;No token was provided to match against notInArray;'%value%' was not found in the haystack notInt;'%value%' does not appear to be an integer notIpAddress;'%value%' does not appear to be a valid IP address notLessThan;'%value%' is not less than '%max%' isEmpty;Value is empty, but a non-empty value is required regexNotMatch;'%value%' does not match against pattern '%pattern%' stringLengthTooShort;'%value%' is less than %min% characters long stringLengthTooLong;'%value%' is greater than %max% characters long |