Download the PHP package timefrontiers/php-validator without Composer
On this page you can find all versions of the php package timefrontiers/php-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download timefrontiers/php-validator
More information about timefrontiers/php-validator
Files in timefrontiers/php-validator
Download timefrontiers/php-validator
More information about timefrontiers/php-validator
Files in timefrontiers/php-validator
Vendor timefrontiers
Package php-validator
Short Description Modern PHP validation library with fluent API and bulk validation support
License MIT
Homepage https://github.com/timefrontiers/php-validator
Package php-validator
Short Description Modern PHP validation library with fluent API and bulk validation support
License MIT
Homepage https://github.com/timefrontiers/php-validator
Please rate this library. Is it a good library?
Informations about the package php-validator
TimeFrontiers PHP Validator
Modern PHP validation library with fluent API and bulk validation support.
Installation
Features
- Fluent, chainable API for single-field validation
- Bulk validation with string or array syntax
- Automatic value sanitization
- Custom error messages
- Nullable/optional field support
- 30+ built-in validation rules
- Custom rule support
- Exception-based validation
Quick Start
Single Field Validation (Fluent API)
Bulk Validation
Validate or Throw
Validation Rules
String Rules
| Rule | Description | Example |
|---|---|---|
name |
Human name (letters, hyphens, apostrophes) | name or name:2,35 |
username |
Alphanumeric with optional chars | username:3,32 |
email |
Valid email address | email |
password |
Strong password | password:8,128 |
phone / tel |
E.164 phone format | phone |
url |
Valid URL with protocol | url |
ip |
IPv4 or IPv6 address | ip or ip:v4 |
text |
Plain text with length | text:10,1000 |
html |
HTML content | html:0,5000 |
slug |
URL-friendly slug | slug:1,128 |
uuid |
UUID v4 format | uuid |
json |
Valid JSON string | json |
hex |
Hexadecimal string | hex or hex:32 |
color |
Hex color code | color |
alpha |
Letters only | alpha:2,50 |
alphanumeric |
Letters and numbers | alphanumeric |
pattern / regex |
Custom regex | pattern:/^[A-Z]+$/ |
Numeric Rules
| Rule | Description | Example |
|---|---|---|
int / integer |
Integer with optional range | int or int:1,100 |
float / decimal |
Float with optional range | float:0.0,99.99 |
boolean / bool |
Boolean value | boolean |
Date/Time Rules
| Rule | Description | Example |
|---|---|---|
date |
Date with optional range | date or date:Y-m-d,2020-01-01,2030-12-31 |
time |
Time (HH:MM:SS) | time or time:09:00:00,17:00:00 |
datetime |
Datetime | datetime |
Choice Rules
| Rule | Description | Example |
|---|---|---|
in / option |
Value in list | in:active,inactive,pending |
notIn |
Value not in list | notIn:banned,deleted |
Array Rules
| Rule | Description | Example |
|---|---|---|
array |
Is array with count | array:1,10 |
arrayOf |
Each item passes rule | (fluent only) |
Special Rules
| Rule | Description | Example |
|---|---|---|
creditcard |
Luhn algorithm check | creditcard |
countryCode |
ISO 3166-1 alpha-2 | countryCode |
currencyCode |
ISO 4217 | currencyCode |
fileExtension |
File extension check | (fluent only) |
Modifier Rules
| Rule | Description | Example |
|---|---|---|
required |
Must be present | required |
nullable |
Allow null/empty | nullable |
min |
Minimum length | min:5 |
max |
Maximum length | max:255 |
length |
Exact length | length:10 |
between |
Length range | between:5,20 |
Fluent API Details
Basic Chain
Nullable Fields
Custom Messages
Custom Rules
Get Value Directly
Throw on Failure
Bulk Validation Details
String Syntax
Array Syntax
Custom Messages
Dot Notation
Result Methods
Rule Details
Password Rule
Username Rule
Date Rule
Array Validation
ValidationException
Extending with Custom Rules
Using Rules Class Directly
License
MIT
All versions of php-validator with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.1
The package timefrontiers/php-validator contains the following files
Loading the files please wait ...