composer require syntatis/utils
This PHP package includes a number of functions to perform common value validation, such as if a value is an email, URL, or not being blank.
Function | Description |
---|---|
is_blank |
Validates whether a value is blank or empty. |
is_email |
Validates whether a value is a valid email address. |
is_url |
Validates whether a value is a valid URL. |
is_uuid |
Validates whether a value is a valid UUID. |
is_semver |
Validates whether a value is a valid SemVer format. |
is_ip_address |
Validates whether a value is a valid IPv4 or IPv6 address. |
is_unique |
Validates that all elements in the provided collection are unique. |
For examples:
use function Syntatis\Utils\is_blank;
use function Syntatis\Utils\is_email;
// Whether a value is blank or empty.
is_blank(''); // `true`.
is_blank(' '); // `true`.
is_blank('foo '); // `false`.
For other functions and examples, please refer to the Wiki.