Class Validate
Provides various methods for validating data for varius datatypes.
Namespace: Phramework\Validate
Deprecated: since 0.0.0
License: Apache-2.0
Author: Xenofon Spafaridis nohponex@gmail.com
Located at Validate.php
Deprecated: since 0.0.0
License: Apache-2.0
Author: Xenofon Spafaridis nohponex@gmail.com
Located at Validate.php
Methods summary
public static
|
|
public static
|
#
validateCustomType( string $type, mixed $value, string $field_name, array $model = [] )
Validate a custom data type. |
public static
boolean
|
|
public
boolean
|
|
public static
integer
|
#
int( string|integer $input, integer|null $min = null, integer|null $max = null, string $field_name = 'int' )
Validate a signed integer |
public static
integer
|
#
uint( string|integer $input, integer $min = 0, integer|null $max = null, String $field_name = 'uint' )
Validate an unsigned integer |
public static
float
|
#
float( string|float|integer $input, float|null $min = null, float|null $max = null, string $field_name = 'float' )
Validate a floating point number |
public static
float
|
#
double( string|float|float|integer $input, float|null $min = null, float|null $max = null, string $field_name = 'double' )
Validate a double presision floating point number |
public static
string
|
|
public static
string
|
|
public static
string
|
|
public static
string
|
|
public static
returns
|
#
enum( string|integer $input, array $values, string $field_name = 'enum' )
Check if input value is in allowed values |
public static
string
|
|
public static
string
|
#
color( type $input, string $type = Validate::COLOR_HEX, string $field_name = 'color' )
Validate color |
public static
string
|
|
public static
string
|
|
public static
boolean
|
Constants summary
string |
REQUIRED
Required field |
#
'required'
|
string |
TYPE_TEXT
Text type |
#
'text'
|
string |
TYPE_STRING
Alias of Text type |
#
'text'
|
string |
TYPE_TEXTAREA
Multiline text type |
#
'textarea'
|
string |
TYPE_INT
Signed integer type |
#
'int'
|
string |
TYPE_UINT
Unsigned integer type |
#
'uint'
|
string |
TYPE_FLOAT
Floating point number type |
#
'float'
|
string |
TYPE_DOUBLE
Double presision floating point number type |
#
'double'
|
string |
TYPE_BOOLEAN
boolean type |
#
'boolean'
|
string |
TYPE_COLOR
Color type |
#
'color'
|
string |
TYPE_USERNAME
|
#
'username'
|
string |
TYPE_EMAIL
|
#
'email'
|
string |
TYPE_PASSWORD
|
#
'password'
|
string |
TYPE_TOKEN
|
#
'token'
|
string |
TYPE_URL
|
#
'url'
|
string |
TYPE_PERMALINK
|
#
'permalink'
|
string |
TYPE_DATE
|
#
'date'
|
string |
TYPE_DATETIME
|
#
'datetime'
|
string |
TYPE_REGEXP
|
#
'regexp'
|
string |
TYPE_UNIX_TIMESTAMP
Unix timestamp (unsigned integer) |
#
'unix_timestamp'
|
string |
TYPE_ENUM
This type allows only specific values |
#
'enum'
|
string |
TYPE_JSON
|
#
'json'
|
string |
TYPE_JSON_ARRAY
|
#
'json_array'
|
string |
TYPE_ARRAY
|
#
'array'
|
string |
TYPE_ARRAY_CSV
Comma separated array |
#
'array_csv'
|
string |
REGEXP_RESOURCE_ID
Regular expression of resource ID |
#
'/^d+$/'
|
string |
REGEXP_USERNAME
Regular expresion of username |
#
'/^[A-Za-z0-9_\.]{3,64}$/'
|
string |
REGEXP_TOKEN
Regular expresion of a token |
#
'/^[A-Za-z0-9_]{3,48}$/'
|
string |
REGEXP_PERMALINK
Regular expresion of a permalink |
#
'/^[A-Za-z0-9_]{3,32}$/'
|
string |
COLOR_HEX
|
#
'hex'
|