Validate
in package
Validate class have many method for sanitizing validating and increase seafety of your inputs
Table of Contents
- decrypt() : bool
- Decrypt pass and compare with hashed str and return result
- encrypt() : string
- Hash a string
- inputTest() : string|false
- htmlspecialchars + check length limit and use a callback function for validatin with another method return safe string
- patternString() : bool
- compare and matches string with your pattern
- sanitizeEmail() : string
- Sanitize email address
- sanitizeUrl() : string
- Sanitizing URL
- validateEmail() : bool
- Validating email address
- validateInt() : bool
- Validate inreger
- validateIp() : bool
- Vaklidating ip
- validateIpv6() : bool
- Validating IPv6
- validateUrl() : bool
- Validating URL
- webAddressValidate() : bool
- Validating web address
Methods
decrypt()
Decrypt pass and compare with hashed str and return result
public
static decrypt(string $str, string $hash) : bool
Parameters
- $str : string
-
Original str
- $hash : string
-
Hashed str
Tags
Return values
bool —encrypt()
Hash a string
public
static encrypt(string $str[, int $cost = 10 ]) : string
Parameters
- $str : string
-
String input
- $cost : int = 10
-
Your cost default is '10'
Tags
Return values
string —inputTest()
htmlspecialchars + check length limit and use a callback function for validatin with another method return safe string
public
static inputTest(string $str, int $length_limit[, callable $validate = null ]) : string|false
Parameters
- $str : string
-
Input string
- $length_limit : int
- $validate : callable = null
Tags
Return values
string|false —patternString()
compare and matches string with your pattern
public
static patternString(string $str, string $pattern) : bool
Parameters
- $str : string
-
String input
- $pattern : string
-
Your ppattern
Tags
Return values
bool —sanitizeEmail()
Sanitize email address
public
static sanitizeEmail(string $email) : string
Parameters
- $email : string
-
Email address
Tags
Return values
string —sanitizeUrl()
Sanitizing URL
public
static sanitizeUrl(string $url) : string
Parameters
- $url : string
-
Input URL
Tags
Return values
string —validateEmail()
Validating email address
public
static validateEmail(string $email) : bool
Parameters
- $email : string
-
Email adress
Tags
Return values
bool —validateInt()
Validate inreger
public
static validateInt(mixed $var) : bool
Parameters
- $var : mixed
Tags
Return values
bool —validateIp()
Vaklidating ip
public
static validateIp(string $ip) : bool
Parameters
- $ip : string
-
IP address
Tags
Return values
bool —validateIpv6()
Validating IPv6
public
static validateIpv6(string $ip) : bool
Parameters
- $ip : string
-
IPv6 address
Tags
Return values
bool —validateUrl()
Validating URL
public
static validateUrl(string $url) : bool
Parameters
- $url : string
-
Input URL
Tags
Return values
bool —webAddressValidate()
Validating web address
public
static webAddressValidate(string $url) : bool
Parameters
- $url : string
-
Web address