==================== Validation reference ==================== ``HasFileSize`` --------------- .. class:: HasFileSize Checks that a file's size is less than or equal to the bytes specified in ``$allowedSize``. .. method:: validate($value, $allowedSize) :param int $allowedSize: Allowed file size in bytes. ``HasLinkCount`` ---------------- .. class:: HasLinkCount Checks that the quantity of hyperlinks in a string is less than the amount specified in ``$allowedLinks``. .. method:: validate($value[, $allowedLinks]) :param int $allowedLinks: Allowed number of links. Defaults to ``10``. ``HasWordCount`` ---------------- .. class:: HasWordCount Checks that the word count in a string obeys the boundaries specified in ``$min`` and ``$max``. .. method:: validate($value, $min[, $max]) :param int $min: Minimum number of words required. :param int $max: Maximum number of words allowed. ``IsAlphaNumeric`` ------------------ .. class:: IsAlphaNumeric Checks that a string contains only alphanumeric characters. ``IsBetween`` ------------- .. class:: IsBetween Checks that a value is between ``$min`` and ``$max``. If the value is a string, the validator uses the length of the string to compute the validation. .. method:: validate($value, $min, $max) :param int $min: Minimum value. :param int $max: Maximum value. ``IsCheckbox`` -------------- .. class:: IsCheckbox Checks that a value is either ``true`` or ``false``. ``IsDate`` ---------- .. class:: IsDate Checks that a string is a valid date representation. Accepts numeric date values, such as ``2010-08-18``, ``18/08/2010``, or ``08182010``. ``IsDateDay`` ------------- .. class:: IsDateDay Checks that a string is a valid date-day representation. ``IsDateMonth`` --------------- .. class:: IsDateMonth Checks that a string is a valid date-month representation. Accepts both numeric and string values, i.e. both ``12`` and ``December``. ``IsDateYear`` -------------- .. class:: IsDateYear Checks that a string is a valid date-year representation. ``IsEmail`` ----------- .. class:: IsEmail Checks that a string is a valid email address. See `RFC 2822 `_. ``IsIP`` -------- .. class:: IsIP Checks that a string is a valid IP address, only IPv4. ``IsMIMEType`` -------------- .. class:: IsMIMEType Checks that a file is one of the MIME types specified in ``$mimeTypes``. .. method:: validate($value, $mimeTypes) :param arr $mimeTypes: Allowed MIME types. ``IsMoney`` ----------- .. class:: IsMoney Checks that a string is a valid currency format. Accepts US dollars, British pounds sterling, and euros. ``IsNumeric`` ------------- .. class:: IsNumeric Checks that a value is numeric. ``IsOneOf`` ----------- .. class:: IsOneOf Checks that a value is in a particular set of possible values. .. method:: validate($value, $option1, $option2...) :param str $option..: Allowed options. ``IsPhoneNumber`` ----------------- .. class:: IsPhoneNumber Checks that a string is a valid US phone number. ``IsPostalCode`` ---------------- .. class:: IsPostalCode Checks that a string is a valid US or Canadian postal code. ``IsRanked`` ------------ .. class:: IsRanked Checks that a series of values is uniquely ranked from ``1`` to the integer specified in ``$min``. .. method:: validate($value, $min) :param int $min: Minimum number of required rank values. ``IsRequired`` -------------- .. class:: IsRequired Checks that a value is not empty. ``IsStateOrProvince`` --------------------- .. class:: IsStateOrProvince Checks that a string is a valid US state or Canadian province. Accepts abbreviations and full names, i.e. ``MN`` and ``Minnesota``. ``IsTime`` ---------- .. class:: IsTime Checks that a string is a valid time representation. Accepts a wide range of values, such as: * ``5:00`` * ``5:00 A.M.`` * ``3pm`` * ``19:29`` ``IsUnique`` ------------ .. class:: IsUnique Checks that the individual values in a series are all unique. ``IsURL`` --------- .. class:: IsURL Checks that a string is a valid URL. Uses `filter_var() `_ and `FILTER_VALIDATE_URL `_. ``IsWithinDateRange`` --------------------- .. class:: IsWithinDateRange Checks that a value is within the date range specified in ``$minDate`` and ``$maxDate``. .. method:: validate($value, $minDate, $maxDate) :param string $minDate: Minimum date. Run through `strtotime() `_. :param string $maxDate: Maximum date. Run through `strtotime() `_. ``MatchesPattern`` ------------------ .. class:: MatchesPattern Checks that a string matches the regular expression specified in ``$pattern``. .. method:: validate($value, $pattern) :param string $pattern: Regular-expression pattern to which to match