Complete reference of all 30 built-in validation rules.
- Comparison (2 rules)
- Core (1 rules)
- Date (1 rules)
- File (2 rules)
- Numeric (3 rules)
- String (14 rules)
- Type (7 rules)
notIn - Validates that a value does not exist in a forbidden list or as an obj...
Description:
Validates that a value does not exist in a forbidden list or as an object property
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
forbidden | object|array | ✓ | Array or object of forbidden values Example: ["admin","root"] |
Usage:
$verifier->field("test")->notIn(["admin", "root"])in - Validates that a value exists in an allowed list or as an object prope...
Description:
Validates that a value exists in an allowed list or as an object property
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
allowed | object|array | ✓ | Array or object of allowed values Example: ["active","pending"] |
Usage:
$verifier->field("test")->in(["active", "pending"])required - Validates that a field is not empty. Objects are cast to arrays to che...
Description:
Validates that a field is not empty. Objects are cast to arrays to check emptiness.
Usage:
$verifier->field("test")->requireddate - Validates that a value is a valid date in the specified format. Perfor...
Description:
Validates that a value is a valid date in the specified format. Performs strict validation
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
format | string | ✗ | Date format Example: 'Y-m-d'Default: 'Y-m-d' |
Usage:
$verifier->field("test")->date("Y-m-d")fileMime - Validates that a file has an allowed MIME type
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
mime | array|string | ✓ | Allowed MIME type(s) Example: 'image/jpeg' |
Usage:
$verifier->field("test")->fileMime("image/jpeg")fileExists - Validates that a file exists at the given path
Usage:
$verifier->field("test")->fileExistsbetween - Validates that a value is between two bounds. Supports numeric values ...
Description:
Validates that a value is between two bounds. Supports numeric values and DateTime objects
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
min | DateTime|string|int|float | ✓ | Minimum value (inclusive) Example: 18 |
max | DateTime|string|int|float | ✓ | Maximum value (inclusive) Example: 65 |
Usage:
$verifier->field("test")->between(18, 65)greaterThan - Validates that a value is greater than a specified limit
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
min | mixed | ✓ | Value must be greater than this Example: 18 |
Usage:
$verifier->field("test")->greaterThan(18)lowerThan - Validates that a value is less than a specified limit
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
max | mixed | ✓ | Value must be less than this Example: 65 |
Usage:
$verifier->field("test")->lowerThan(65)alphanumeric - Validates that a value contains only alphanumeric characters
Usage:
$verifier->field("test")->alphanumericmaxLength - Validates that a string does not exceed maximum length
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
max | int | ✓ | Maximum length allowed Example: 20 |
Usage:
$verifier->field("test")->maxLength(20)disposableEmail - Validates that an email is not from a disposable domain, can be overri...
Description:
Validates that an email is not from a disposable domain, can be overriden ["@yourDisposableDomain", ...]
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
disposables | array | ✗ | Array of disposable domain patterns Example: []Default: [] |
Usage:
$verifier->field("email")->disposableEmail$verifier->field("email")->disposableEmail(["@yourDisposableDomain", ...])disposableUrlDomain - Validates that a URL is not from a disposable/temporary domain (URL sh...
Description:
Validates that a URL is not from a disposable/temporary domain (URL shorteners, free hosting, etc.)
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
disposables | array | ✗ | Array of disposable domain patterns Example: []Default: [] |
Usage:
$verifier->field("website")->disposableUrlDomain$verifier->field("website")->disposableUrlDomain(["bit.ly", "tinyurl.com"])url - Validates that a value is a valid URL with configurable schemes and TL...
Description:
Validates that a value is a valid URL with configurable schemes and TLD requirement
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
schemes | array | ✗ | Allowed URL schemes Example: ["http","https"]Default: ["http","https"] |
requireTld | bool | ✗ | Require a top-level domain (.com|.org|.net|...) Example: trueDefault: true |
Usage:
$verifier->field("website")->url$verifier->field("api")->url(["http", "https", "ws", "wss"])$verifier->field("intranet")->url(["http"], requireTld: false)containsNumber - Validates that a string contains at least one digit
Usage:
$verifier->field("test")->containsNumbernotAlphanumeric - Validates that a value contains non-alphanumeric characters
Usage:
$verifier->field("test")->notAlphanumericminLength - Validates that a string has a minimum length
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
min | int | ✓ | Minimum length required Example: 8 |
Usage:
$verifier->field("test")->minLength(8)containsUpper - Validates that a string contains at least one uppercase letter
Usage:
$verifier->field("test")->containsUpperemail - Validates that a value is a valid email address
Usage:
$verifier->field("test")->emailregex - Validates that a value matches a regular expression pattern. Warnings ...
Description:
Validates that a value matches a regular expression pattern. Warnings are suppressed
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
pattern | string | ✓ | Regular expression pattern Example: '/^[A-Z]+$/' |
Usage:
$verifier->field("test")->regex("/^[A-Z]+$/")ipAddress - Validates that a value is a valid IP address (IPv4 or IPv6)
Usage:
$verifier->field("test")->ipAddresscontainsLower - Validates that a string contains at least one lowercase letter
Usage:
$verifier->field("test")->containsLowercontainsSpecialCharacter - Validates that a string contains at least one special character
Usage:
$verifier->field("test")->containsSpecialCharacterstring - Validates that a value is a string
Usage:
$verifier->field("test")->stringint - Validates that a value is an integer. In strict mode (default), only t...
Description:
Validates that a value is an integer. In strict mode (default), only true integers are accepted
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
strict | bool | ✗ | Strict mode: true for integers only Example: trueDefault: true |
Usage:
$verifier->field("test")->int(true)array - Validates that a value is an array
Usage:
$verifier->field("test")->arrayobject - Validates that a value is an object
Usage:
$verifier->field("test")->objectboolean - Validates that a value is a boolean. In strict mode (default), only tr...
Description:
Validates that a value is a boolean. In strict mode (default), only true/false are accepted
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
strict | bool | ✗ | Strict mode: true for booleans only Example: trueDefault: true |
Usage:
$verifier->field("test")->boolean(true)json - Validates that a string is valid JSON
Usage:
$verifier->field("test")->jsonnumeric - Validates that a value is numeric
Usage:
$verifier->field("test")->numeric- Error Handling - Working with validation errors
- Conditional Validation - Apply rules conditionally
- Custom Strategies - Create your own validations
- Internationalization - Translate error messages