The field under validation must be yes, on, 1, or true. This is useful for validating "Terms of Service" acceptance.
The field under validation must be a value after or equal to the given date.
The field under validation must be entirely alphabetic characters.
The field under validation may have alpha-numeric characters, dashes and underscores.
The field under validation must be entirely alpha-numeric characters.
The field under validation must be an array.
Stop running validation rules after the first validation failure.
The field under validation must be a value preceding the given date. Like the after
rule, the name of another field under validation may be supplied as the value of date
.
The field under validation must have a size between the given min and max.
The field under validation must be able to be cast as a boolean. Accepted input are true
, false
, 1
, 0
, "1"
, and "0"
.
The field under validation must have a matching field of foo_confirmation
. For example, if the field under validation is password
, a matching password_confirmation
field must be present in the input.
The field under validation must be a valid, non-relative date.
The field under validation must have a different value than field. In this example Second Field mus be different than First Field.
The field under validation must be numeric and must have an exact length of value.
The field under validation must have a length between the given min and max.
The field under validation must be formatted as an e-mail address.
The field under validation must be a successfully uploaded file.
This rule validates against these common file types: jpg, jpeg, gif, png, bmp, tif, psd, pdf, doc, docx, xls, xlsx, txt, mp3, mp4, aac, wav, au, wmv, avi, mpg, mpeg, zip, gz, rar, z, tgz, tar, sitx.
The field under validation must not be empty when it is present.
The field under validation must be greater than the given field. The two fields must be of the same type. Strings, numerics, arrays, and files are evaluated using the same conventions as the size rule.
The field under validation must be greater than or equal to the given field. The two fields must be of the same type. Strings, numerics, arrays, and files are evaluated using the same conventions as the size
rule.
The file under validation must be an image (jpeg, png, bmp, gif, or svg)
The field under validation must exist in anotherfield's values.
The field under validation must be an integer.
The field under validation must be an IP address. This rule accepts ipv4 and ipv6.
The field under validation must be an IPv4 address.
The field under validation must be an IPv6 address.
The field under validation must be a valid JSON string.
The field under validation must be less than the given field. The two fields must be of the same type. Strings, numerics, arrays, and files are evaluated using the same conventions as the size rule.
The field under validation must be less than or equal to the given field. The two fields must be of the same type. Strings, numerics, arrays, and files are evaluated using the same conventions as the size rule.
The field under validation must be less than or equal to a maximum value.
The file under validation must match one of the given MIME types.
A full listing of MIME types and their corresponding extensions can be seen here: https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
The file under validation must have a specified extension. More than one extension can be specified separated by commas.
A full listing of MIME types and their corresponding extensions can be seen here: https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
This example only accepts .pdf files.
The field under validation must have a minimum value.
The field under validation must not match the given regular expression.
Internally, this rule uses the PHP preg_match function. The pattern specified should obey the same formatting required by preg_match and thus also include valid delimiters. For example: rules="not_regex:/^.+$/i"
Note: When using the regex / not_regex patterns, it may be necessary to specify rules in an array instead of using pipe delimiters, especially if the regular expression contains a pipe character.
The field under validation may be null. This is particularly useful when validating primitive such as strings and integers that can contain null values.
The field under validation must be numeric.
The field under validation must match the given regular expression.
Internally, this rule uses the PHP preg_match function. The pattern specified should obey the same formatting required by preg_match and thus also include valid delimiters. For example: rules="regex:/^.+@.+$/i"
Note: When using the regex / not_regex patterns, it may be necessary to specify rules in an array instead of using pipe delimiters, especially if the regular expression contains a pipe character.
The field under validation must be present in the input data and not empty. A field is considered "empty" if one of the following conditions are true:
The field under validation must be present and not empty if the anotherfield field is equal to any value.
The field under validation must be present and not empty unless the anotherfield field is equal to any value.
The field under validation must be present and not empty only if any of the other specified fields are present.
The field under validation must be present and not empty only if all of the other specified fields are present.
The field under validation must be present and not empty only when any of the other specified fields are not present.
The field under validation must be present and not empty only when all of the other specified fields are not present.
The given field must match the field under validation.
The field under validation must have a size exactly matching the given value.
The field under validation must start with one of the given values.
The field under validation must be a string. If you would like to allow the field to also be null, you should assign the nullable rule to the field.
The field under validation must be a valid timezone identifier according to the timezone_identifiers_list PHP function.
The field under validation must be a valid URL.
The field under validation must be a valid RFC 4122 (version 1, 3, 4, or 5) universally unique identifier (UUID).