\CodeIgniter\ValidationFormatRules

Format validation Rules.

Summary

Methods
Properties
Constants
alpha()
alpha_space()
alpha_dash()
alpha_numeric()
alpha_numeric_space()
string()
decimal()
integer()
is_natural()
is_natural_no_zero()
numeric()
regex_match()
timezone()
valid_base64()
valid_json()
valid_email()
valid_emails()
valid_ip()
valid_url()
valid_date()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

alpha()

alpha(string  $str = null) : boolean

Alpha

Parameters

string $str

Returns

boolean

alpha_space()

alpha_space(string  $value = null) : boolean

Alpha with spaces.

Parameters

string $value

Value.

Returns

boolean —

True if alpha with spaces, else false.

alpha_dash()

alpha_dash(string  $str = null) : boolean

Alpha-numeric with underscores and dashes

Parameters

string $str

Returns

boolean

alpha_numeric()

alpha_numeric(string  $str = null) : boolean

Alpha-numeric

Parameters

string $str

Returns

boolean

alpha_numeric_space()

alpha_numeric_space(string  $str = null) : boolean

Alpha-numeric w/ spaces

Parameters

string $str

Returns

boolean

string()

string(string|null  $str = null) : boolean

Any type of string

Note: we specifically do NOT type hint $str here so that it doesn't convert numbers into strings.

Parameters

string|null $str

Returns

boolean

decimal()

decimal(string  $str = null) : boolean

Decimal number

Parameters

string $str

Returns

boolean

integer()

integer(string  $str = null) : boolean

Integer

Parameters

string $str

Returns

boolean

is_natural()

is_natural(string  $str = null) : boolean

Is a Natural number (0,1,2,3, etc.)

Parameters

string $str

Returns

boolean

is_natural_no_zero()

is_natural_no_zero(string  $str = null) : boolean

Is a Natural number, but not a zero (1,2,3, etc.)

Parameters

string $str

Returns

boolean

numeric()

numeric(string  $str = null) : boolean

Numeric

Parameters

string $str

Returns

boolean

regex_match()

regex_match(string  $str = null, string  $pattern, array  $data) : boolean

Compares value against a regular expression pattern.

Parameters

string $str
string $pattern
array $data

Other field/value pairs

Returns

boolean

timezone()

timezone(string  $str = null) : boolean

Validates that the string is a valid timezone as per the timezone_identifiers_list function.

Parameters

string $str

Returns

boolean

valid_base64()

valid_base64(string  $str = null) : boolean

Valid Base64

Tests a string for characters outside of the Base64 alphabet as defined by RFC 2045 http://www.faqs.org/rfcs/rfc2045

Parameters

string $str

Returns

boolean

valid_json()

valid_json(string  $str = null) : boolean

Valid JSON

Parameters

string $str

Returns

boolean

valid_email()

valid_email(string  $str = null) : boolean

Checks for a correctly formatted email address

Parameters

string $str

Returns

boolean

valid_emails()

valid_emails(string  $str = null) : boolean

Validate a comma-separated list of email addresses.

Example: valid_emails[one@example.com,two@example.com]

Parameters

string $str

Returns

boolean

valid_ip()

valid_ip(string  $ip = null, string  $which = null, array  $data) : boolean

Validate an IP address

Parameters

string $ip

IP Address

string $which

IP protocol: 'ipv4' or 'ipv6'

array $data

Returns

boolean

valid_url()

valid_url(string  $str = null) : boolean

Checks a URL to ensure it's formed correctly.

Parameters

string $str

Returns

boolean

valid_date()

valid_date(string  $str = null, string  $format = null) : boolean

Checks for a valid date and matches a given date format

Parameters

string $str
string $format

Returns

boolean