⌨️Validation
This package is outdated and the documentation as well
Email
An easy no-hassle way to validate email addresses. It validates on basic faults like not a valid format, but it also checks if the domain can be mailed.
validate_email($email, $debug = false)
Example:
use NanFunctions\Validate;
$validator = new Validate();
$valid = $validator->validate_email('[email protected]');
echo $valid ? 'Valid' : 'Invalid';
Tip: Set the debug paramater to true to see what the email fails on
Phone
An easy no-hassle way to validate a phone number.
validate_phone_number($email, $country_code= false)
Example:
use NanFunctions\Validate;
$validator = new Validate();
// First parameter is the phone number. Second paramater is if country code is allow
$valid = $validator->validate_phone_number('+31612345678', true);
echo $valid ? 'Valid' : 'Invalid';
Tip: Set the debug paramater to true to allow the phone number to have a country code like +31
Last updated