Documentation

Validation
in package

FinalYes

Data validation utility class.

Provides validation methods for common data types including hostname, IP address, CIDR notation, email, port number, Unix username, and file paths.

Table of Contents

Methods

email()  : bool
Check if it is an e-mail.
hostname()  : bool
Check if it is a host name.
hostname_or_ipaddress()  : bool
Check if it is a host name or IP.
ipaddress()  : bool
Check if it is an IP.
ipaddress_or_cidr()  : bool
Check if it is IP or CIDR format.
is_path()  : bool
Check if it is a file (directory) path.
port()  : bool
Check if it is a port number.
unix_username()  : bool
Check if it is a unix user name.

Methods

email()

Check if it is an e-mail.

public static email(string $value) : bool
Parameters
$value : string

Value to be validated.

Return values
bool

Pass is true, fail is false.

hostname()

Check if it is a host name.

public static hostname(string $value) : bool
Parameters
$value : string

Value to be validated.

Return values
bool

Pass is true, fail is false.

hostname_or_ipaddress()

Check if it is a host name or IP.

public static hostname_or_ipaddress(string $value) : bool
Parameters
$value : string

Value to be validated.

Return values
bool

Pass is true, fail is false.

ipaddress()

Check if it is an IP.

public static ipaddress(string $value) : bool
Parameters
$value : string

Value to be validated.

Return values
bool

Pass is true, fail is false.

ipaddress_or_cidr()

Check if it is IP or CIDR format.

public static ipaddress_or_cidr(string $value) : bool
Parameters
$value : string

Value to be validated.

Return values
bool

Pass is true, fail is false.

is_path()

Check if it is a file (directory) path.

public static is_path(string $value[, bool $denyLeadingSlash = false ]) : bool
Parameters
$value : string

Value to be validated.

$denyLeadingSlash : bool = false
Return values
bool

Pass is true, fail is false.

port()

Check if it is a port number.

public static port(string $value) : bool
Parameters
$value : string

Value to be validated.

Return values
bool

Pass is true, fail is false.

unix_username()

Check if it is a unix user name.

public static unix_username(string $value) : bool
Parameters
$value : string

Value to be validated.

Return values
bool

Pass is true, fail is false.


        
On this page

Search results