CodeIgniter v4.7 API

FormatRules
in package

Format validation Rules.

Tags
see
FormatRulesTest

Table of Contents

Properties

$nonStrictFormatRules  : FormatRules

Methods

__construct()  : mixed
alpha()  : bool
Alpha
alpha_dash()  : bool
Alphanumeric with underscores and dashes
alpha_numeric()  : bool
Alphanumeric
alpha_numeric_punct()  : bool
Alphanumeric, spaces, and a limited set of punctuation characters.
alpha_numeric_space()  : bool
Alphanumeric w/ spaces
alpha_space()  : bool
Alpha with spaces.
decimal()  : bool
Decimal number
hex()  : bool
String of hexidecimal characters
integer()  : bool
Integer
is_natural()  : bool
Is a Natural number (0,1,2,3, etc.)
is_natural_no_zero()  : bool
Is a Natural number, but not a zero (1,2,3, etc.)
numeric()  : bool
Numeric
regex_match()  : bool
Compares value against a regular expression pattern.
string()  : bool
Any type of string
timezone()  : bool
Validates that the string is a valid timezone as per the timezone_identifiers_list function.
valid_base64()  : bool
Valid Base64
valid_date()  : bool
Checks for a valid date and matches a given date format
valid_email()  : bool
Checks for a correctly formatted email address
valid_emails()  : bool
Validate a comma-separated list of email addresses.
valid_ip()  : bool
Validate an IP address (human readable format or binary string - inet_pton)
valid_json()  : bool
Valid JSON
valid_url()  : bool
Checks a string to ensure it is (loosely) a URL.
valid_url_strict()  : bool
Checks a URL to ensure it's formed correctly.

Properties

Methods

alpha()

Alpha

public alpha([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

alpha_dash()

Alphanumeric with underscores and dashes

public alpha_dash([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

alpha_numeric()

Alphanumeric

public alpha_numeric([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

alpha_numeric_punct()

Alphanumeric, spaces, and a limited set of punctuation characters.

public alpha_numeric_punct(mixed $str) : bool

Accepted punctuation characters are: ~ tilde, ! exclamation,

number, $ dollar, % percent, & ampersand, * asterisk, - dash,

_ underscore, + plus, = equals, | vertical bar, : colon, . period ~ ! # $ % & * - _ + = | : .

Parameters
$str : mixed
Return values
bool

alpha_numeric_space()

Alphanumeric w/ spaces

public alpha_numeric_space([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

alpha_space()

Alpha with spaces.

public alpha_space([mixed $value = null ]) : bool
Parameters
$value : mixed = null

Value.

Return values
bool

True if alpha with spaces, else false.

decimal()

Decimal number

public decimal([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

hex()

String of hexidecimal characters

public hex([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

integer()

Integer

public integer([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

is_natural()

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

public is_natural([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

is_natural_no_zero()

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

public is_natural_no_zero([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

numeric()

Numeric

public numeric([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

regex_match()

Compares value against a regular expression pattern.

public regex_match(mixed $str, string $pattern) : bool
Parameters
$str : mixed
$pattern : string
Return values
bool

string()

Any type of string

public string([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

valid_base64()

Valid Base64

public valid_base64([mixed $str = null ]) : bool

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

Parameters
$str : mixed = null
Return values
bool

valid_date()

Checks for a valid date and matches a given date format

public valid_date([mixed $str = null ][, string|null $format = null ]) : bool
Parameters
$str : mixed = null
$format : string|null = null
Return values
bool

valid_email()

Checks for a correctly formatted email address

public valid_email([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

valid_emails()

Validate a comma-separated list of email addresses.

public valid_emails([mixed $str = null ]) : bool

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

Parameters
$str : mixed = null
Return values
bool

valid_ip()

Validate an IP address (human readable format or binary string - inet_pton)

public valid_ip([mixed $ip = null ][, string|null $which = null ]) : bool
Parameters
$ip : mixed = null
$which : string|null = null

IP protocol: 'ipv4' or 'ipv6'

Return values
bool

valid_json()

Valid JSON

public valid_json([mixed $str = null ]) : bool
Parameters
$str : mixed = null
Return values
bool

valid_url()

Checks a string to ensure it is (loosely) a URL.

public valid_url([mixed $str = null ]) : bool

Warning: this rule will pass basic strings like "banana"; use valid_url_strict for a stricter rule.

Parameters
$str : mixed = null
Return values
bool

valid_url_strict()

Checks a URL to ensure it's formed correctly.

public valid_url_strict([mixed $str = null ][, string|null $validSchemes = null ]) : bool
Parameters
$str : mixed = null
$validSchemes : string|null = null

comma separated list of allowed schemes

Return values
bool
On this page

Search results