Validation
Initiation
use MaplePHP\Validate\Inp;
// Validate option 1
$inp = new Inp("Lorem ipsum dolor");
var_dump($inp->length(1, 200)); // true
// Validate option 2
$valid = Inp::value("Lorem ipsum dolor")->length(1, 200);
var_dump($valid); // trueCheck string length is more than or equal to 1
Inp::value("Lorem ipsum dolor")->length(1);Check string length is more/equal than 1 and less/equal than 160
Inp::value("Lorem ipsum dolor")->length(1, 160);Check if is valid email
Check if is valid phone
Validate Swedish social number (personnummer)
Validate Swedish organisation number
Validate credit card number
Validate VAT number
Check if is a color hex code
Check date and date format
Check date, date format and is between a range
Check if persons is at least 18 years old or older.
Check if is a valid domain name
Check if is a valid URL (http/https is required)
Check if is a valid DNS
Last updated