Download the PHP package fyre/validation without Composer
On this page you can find all versions of the php package fyre/validation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package validation
FyreValidation
FyreValidation is a free, open-source validation library for PHP.
Table Of Contents
- Installation
- Validators
- Rules
- Error Messages
Installation
Using Composer
In PHP:
Validators
Add
Add a validation rule.
$field
is a string representing the field name.$rule
is a Closure or a Rule representing the validation rule.$options
is an array containing options for the validation rule.on
is a string representing the type of validation the rule applies to, and will default to null.message
is a string representing the error message for the rule, and will default to null.name
is a string representing the name of the validation rule, and will default to null.skipEmpty
is a boolean indicating whether the rule should be skipped if the value is empty, and will default to true.
Clear
Clear all rules from the Validator.
Get Field Rules
Get the rules for a field.
$field
is a string representing the field name.
Remove
Remove a validation rule.
$field
is a string representing the field name.$name
is a string representing the rule name.
If the $name
argument is omitted, all rules will be removed instead.
Validate
Perform validation and return any errors.
$data
is an array containing the data to validate.$type
is a string representing the type of validation, and will default to null.
Rules
Alpha
Create an "alpha" Rule.
Alpha Numeric
Create an "alpha-numeric" Rule.
Ascii
Create an "ASCII" Rule.
Between
Create a "between" Rule.
$min
is a number representing the minimum value (inclusive).$max
is a number representing the maximum value (inclusive).
Boolean
Create a "boolean" Rule.
Decimal
Create a "decimal" Rule.
Date
Create a "date" Rule.
DateTime
Create a "date/time" Rule.
Differs
Create a "differs" Rule.
$field
is a string representing the other field to compare against.
Create an "email" Rule.
Empty
Create an "empty" Rule.
Equals
Create an "equals" Rule.
$value
is the value to compare against.
Exact Length
Create an "exact length" Rule.
$length
is a number representing the length.
Greater Than
Create a "greater than" Rule.
$min
is the minimum value.
Greater Than Or Equals
Create a "greater than or equals" Rule.
$min
is the minimum value.
In
Create an "in" Rule.
$values
is an array containing the values to compare against.
Integer
Create an "integer" Rule.
Ip
Create an "IP" Rule.
Ipv4
Create an "IPv4" Rule.
Ipv6
Create an "IPv6" Rule.
Less Than
Create a "less than" Rule.
$max
is the maximum value.
Less Than Or Equals
Create a "less than or equals" Rule.
$max
is the maximum value.
Matches
Create a "matches" Rule.
$field
is a string representing the other field to compare against.
Max Length
Create a "maximum length" Rule.
$length
is a number representing the maximum length.
Min Length
Create a "minimum length" Rule.
$length
is a number representing the minimum length.
Natural Number
Create a "natural number" Rule.
Not Empty
Create an "not empty" Rule.
Regex
Create a "regular expression" Rule.
$regex
is a string representing the regular expression.
Required
Create a "required" Rule.
Require Presence
Create a "require presence" Rule.
Time
Create a "time" Rule.
Url
Create a "URL" Rule.
Error Messages
Custom error messages can be used by supplying the message
property of the $options
array to the Validator add
method.
Alternatively, for custom validation callbacks, a string can be returned and that will be used as the error messages.
If a custom error message is not supplied, the rule name will be used to retrieve a Lang value. The field placeholder can be used for the field name, and any arguments supplied to the rule will be available as numeric placeholders.
If no error message is available, the error message will simply be set to "invalid".