| Fully Qualified Name: | CodeIgniter\Validation\Rules |
Validation Rules.
| Name | Description | Defined By |
|---|---|---|
| differs() | The value does not match another field in $data. | Rules |
| equals() | Equals the static value provided. | Rules |
| exact_length() | Returns true if $str is $val characters long. | Rules |
| greater_than() | Greater than | Rules |
| greater_than_equal_to() | Equal to or Greater than | Rules |
| in_list() | Value should be within an array of values | Rules |
| is_not_unique() | Checks the database to see if the given value exist. | Rules |
| is_unique() | Checks the database to see if the given value is unique. Can ignore a single record by field/value to make it useful during record updates. | Rules |
| less_than() | Less than | Rules |
| less_than_equal_to() | Equal to or Less than | Rules |
| matches() | Matches the value of another field in $data. | Rules |
| max_length() | Returns true if $str is $val or fewer characters in length. | Rules |
| min_length() | Returns true if $str is at least $val length. | Rules |
| not_equals() | Does not equal the static value provided. | Rules |
| required() | Required | Rules |
| required_with() | The field is required when any of the other required fields are present in the data. | Rules |
| required_without() | The field is required when all of the other fields are present in the data but not required. | Rules |
The value does not match another field in $data.
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $field | string | |
| $data | array | Other |
Returns: bool
Equals the static value provided.
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $val | string |
Returns: bool
Returns true if $str is $val characters long.
$val = "5" (one) | "5,8,12" (multiple values)
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $val | string |
Returns: bool
Greater than
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $min | string |
Returns: bool
Equal to or Greater than
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $min | string |
Returns: bool
Value should be within an array of values
| Parameter Name | Type | Description |
|---|---|---|
| $value | string | |
| $list | string |
Returns: bool
Checks the database to see if the given value exist.
Can ignore records by field/value to filter (currently accept only one filter).
Example: is_not_unique[table.field,where_field,where_value] is_not_unique[menu.id,active,1]
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $field | string | |
| $data | array |
Returns: bool
Checks the database to see if the given value is unique. Can ignore a single record by field/value to make it useful during record updates.
Example: is_unique[table.field,ignore_field,ignore_value] is_unique[users.email,id,5]
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $field | string | |
| $data | array |
Returns: bool
Less than
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $max | string |
Returns: bool
Equal to or Less than
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $max | string |
Returns: bool
Matches the value of another field in $data.
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $field | string | |
| $data | array | Other |
Returns: bool
Returns true if $str is $val or fewer characters in length.
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $val | string |
Returns: bool
Returns true if $str is at least $val length.
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $val | string |
Returns: bool
Does not equal the static value provided.
| Parameter Name | Type | Description |
|---|---|---|
| $str | string | |
| $val | string |
Returns: bool
Required
| Parameter Name | Type | Description |
|---|---|---|
| $str | mixed | Value |
Returns: bool True if valid, false if not
The field is required when any of the other required fields are present in the data.
Example (field is required when the password field is present):
required_with[password]
| Parameter Name | Type | Description |
|---|---|---|
| $str | ||
| $fields | string | List |
| $data | array | Complete |
| $str |
Returns: bool
The field is required when all of the other fields are present in the data but not required.
Example (field is required when the id or email field is missing):
required_without[id,email]
| Parameter Name | Type | Description |
|---|---|---|
| $str | ||
| $fields | string | |
| $data | array | |
| $str |
Returns: bool