Validator
extends BaseValidator
in package
Class Validator.
Table of Contents
- alpha() : bool
- Validates alphabetic characters.
- alphaNumber() : bool
- Validates a number or alphabetic characters.
- array() : bool
- Validates array.
- base64() : bool
- Validates a base64 string.
- between() : bool
- Validate field between min and max values.
- bool() : bool
- Validates boolean.
- datetime() : bool
- Validates a datetime format.
- email() : bool
- Validates a email.
- equals() : bool
- Validate field has value equals other field.
- float() : bool
- Validates float.
- greater() : bool
- Validates is greater than.
- greaterOrEqual() : bool
- Validates is greater than or equal to.
- hex() : bool
- Validates a hexadecimal string.
- hexColor() : bool
- Validates a hexadecimal color.
- in() : bool
- Validate field is in list.
- int() : bool
- Validates integer.
- ip() : bool
- Validates an IP.
- isset() : bool
- Validates field is set.
- json() : bool
- Validates a JSON string.
- latin() : bool
- Validates a latin text.
- length() : bool
- Validates exact length.
- less() : bool
- Validates is less than.
- lessOrEqual() : bool
- Validates is less than or equal to.
- maxLength() : bool
- Validates max length.
- md5() : bool
- Validates a md5 hash.
- minLength() : bool
- Validates min length.
- notBetween() : bool
- Validate field not between min and max values.
- notEquals() : bool
- Validate field has not value equals other field.
- notIn() : bool
- Validate field is not in list.
- notRegex() : bool
- Validates a Regex no matching pattern.
- number() : bool
- Validates a number.
- object() : bool
- Validates object.
- regex() : bool
- Validates a Regex pattern.
- required() : bool
- Validates required value.
- slug() : bool
- Validates slug.
- specialChar() : bool
- Validates special characters.
- string() : bool
- Validates string.
- timezone() : bool
- Validates a timezone.
- url() : bool
- Validates an URL.
- uuid() : bool
- Validates a UUID.
- getData() : string|null
- Get field value from data.
Methods
alpha()
Validates alphabetic characters.
public
static alpha(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —alphaNumber()
Validates a number or alphabetic characters.
public
static alphaNumber(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —array()
Validates array.
public
static array(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Tags
Return values
bool —base64()
Validates a base64 string.
public
static base64(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —between()
Validate field between min and max values.
public
static between(string $field, array<string, mixed> $data, int|string $min, int|string $max) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $min : int|string
- $max : int|string
Return values
bool —bool()
Validates boolean.
public
static bool(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Tags
Return values
bool —datetime()
Validates a datetime format.
public
static datetime(string $field, array<string, mixed> $data[, string $format = 'Y-m-d H:i:s' ]) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $format : string = 'Y-m-d H:i:s'
Return values
bool —email()
Validates a email.
public
static email(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —equals()
Validate field has value equals other field.
public
static equals(string $field, array<string, mixed> $data, string $equalsField) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $equalsField : string
Return values
bool —float()
Validates float.
public
static float(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Tags
Return values
bool —greater()
Validates is greater than.
public
static greater(string $field, array<string, mixed> $data, int|string $greaterThan) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $greaterThan : int|string
Return values
bool —greaterOrEqual()
Validates is greater than or equal to.
public
static greaterOrEqual(string $field, array<string, mixed> $data, int|string $greaterThanOrEqualTo) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $greaterThanOrEqualTo : int|string
Return values
bool —hex()
Validates a hexadecimal string.
public
static hex(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —hexColor()
Validates a hexadecimal color.
public
static hexColor(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —in()
Validate field is in list.
public
static in(string $field, array<string, mixed> $data, string $in, string ...$others) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $in : string
- $others : string
Return values
bool —int()
Validates integer.
public
static int(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Tags
Return values
bool —ip()
Validates an IP.
public
static ip(string $field, array<string, mixed> $data, int|string $version) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $version : int|string
-
4, 6 or 0 to both
Return values
bool —isset()
Validates field is set.
public
static isset(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —json()
Validates a JSON string.
public
static json(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —latin()
Validates a latin text.
public
static latin(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —length()
Validates exact length.
public
static length(string $field, array<string, mixed> $data, int|string $length) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $length : int|string
Return values
bool —less()
Validates is less than.
public
static less(string $field, array<string, mixed> $data, int|string $lessThan) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $lessThan : int|string
Return values
bool —lessOrEqual()
Validates is less than or equal to.
public
static lessOrEqual(string $field, array<string, mixed> $data, int|string $lessThanOrEqualTo) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $lessThanOrEqualTo : int|string
Return values
bool —maxLength()
Validates max length.
public
static maxLength(string $field, array<string, mixed> $data, int|string $maxLength) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $maxLength : int|string
Return values
bool —md5()
Validates a md5 hash.
public
static md5(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —minLength()
Validates min length.
public
static minLength(string $field, array<string, mixed> $data, int|string $minLength) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $minLength : int|string
Return values
bool —notBetween()
Validate field not between min and max values.
public
static notBetween(string $field, array<string, mixed> $data, int|string $min, int|string $max) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $min : int|string
- $max : int|string
Return values
bool —notEquals()
Validate field has not value equals other field.
public
static notEquals(string $field, array<string, mixed> $data, string $diffField) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $diffField : string
Return values
bool —notIn()
Validate field is not in list.
public
static notIn(string $field, array<string, mixed> $data, string $notIn, string ...$others) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $notIn : string
- $others : string
Return values
bool —notRegex()
Validates a Regex no matching pattern.
public
static notRegex(string $field, array<string, mixed> $data, string $pattern) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $pattern : string
Return values
bool —number()
Validates a number.
public
static number(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —object()
Validates object.
public
static object(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Tags
Return values
bool —regex()
Validates a Regex pattern.
public
static regex(string $field, array<string, mixed> $data, string $pattern) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $pattern : string
Return values
bool —required()
Validates required value.
public
static required(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —slug()
Validates slug.
public
static slug(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Tags
Return values
bool —specialChar()
Validates special characters.
public
static specialChar(string $field, array<string, mixed> $data[, int|string $quantity = 1 ][, string $characters = '!"#$%&'()*+,-./:;=<>?@[\]^_`{|}~' ]) : bool
Parameters
- $field : string
- $data : array<string, mixed>
- $quantity : int|string = 1
- $characters : string = '!"#$%&'()*+,-./:;=<>?@[\]^_`{|}~'
Tags
Return values
bool —string()
Validates string.
public
static string(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Tags
Return values
bool —timezone()
Validates a timezone.
public
static timezone(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —url()
Validates an URL.
public
static url(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —uuid()
Validates a UUID.
public
static uuid(string $field, array<string, mixed> $data) : bool
Parameters
- $field : string
- $data : array<string, mixed>
Return values
bool —getData()
Get field value from data.
protected
static getData(string $field, array<string, mixed> $data) : string|null
Parameters
- $field : string
- $data : array<string, mixed>