Documentation

Valid


The valid helper provides a simple and consistent way of validating user input.


email(string $email)


Check an email address for correct format.


if (Valid::email('test@test.com')) {
    // Do something...
}

ip(string $ip)


Check an ip address for correct format.


if (Valid::ip('127.0.0.1')) {
    // Do something...
}

creditCard(integer $num, string $type)


Check an credit card for correct format.


if (Valid::creditCard(7711111111111111, 'Visa')) {
    // Do something...
}

phone(integer $num)


Check an phone number for correct format.


if (Valid::phone(0661111117)) {
    // Do something...
}

url(string $url)


Check an url for correct format.


if (Valid::url('http://site.com/')) {
    // Do something...
}

date(string $str)


Check an date for correct format.


if (Valid::date('12/12/12')) {
    // Do something...
}

digit(string $str)


Checks whether a string consists of digits only (no dots or dashes).


if (Valid::digit('12')) {
    // Do something...
}

numeric(string $str)


Checks whether a string is a valid number (negative and decimal numbers allowed).
Uses {http://www.php.net/manual/en/function.localeconv.php locale conversion}
to allow decimal point to be locale specific.


if (Valid::numeric('3.14')) {
    // Do something...
}

regexp(string $regexp)


Checks if the given regex statement is valid.


if (Valid::regexp('Monstra - fast and simple cms')) {
    // Do something...
}