V2:Types
From PhpInputValidator
This are all the current possible options for the third parameter in the get function. You can also use Custom Types if one of the following do not meet match what you are looking for.
Common Types
These are common PHP types which should not need an explaination
array
boolean / bool
real / double / float
integer / int
object
string / str
even
odd
Extended Types
alpha
String must only contain characters a-z. Case insensitive.
Example
FooBar
alpha_lower
String must only contain characters a-z. Must be all lowercase.
Example
foobar
alpha_numeric
String must only contain characters a-z or 0-9 Case insensitive.
Example
FooBar01
alphanumeric_plus
String must only contain characters a-z, 0-9, -, or _. Case insensitive.
Example
Foo_Bar-01
alpha_upper
String must only contain characters a-z. Must be all uppercase.
Example
FOOBAR
american_express
String must be a valid American Express credit card.
Note
This check only validates the length and digit types. It does not check to make sure the number is actually an active card.
credit_card
String must be a valid credit card number. Doesn't care about the type of card.
Note
This check only validates the length and digit types. It does not check to make sure the number is actually an active card.
day_month_year
A valid day month year string
Example
30/05/2002 30/5/2002 30/5/02 30-5-02
discover_card
String must be a valid Discover credit card.
Note
This check only validates the length and digit types. It does not check to make sure the number is actually an active card.
domain
String must have a valid tld
Example
www.foo.com foo.net http://www.foo.com .com
Email address.
Example
foo@bar.com
fuzzy_bool
Expanded bool types (see examples)
Example
true false 1 0 off on yes no y n
hex
A valid hexidecimal number
Example
FF00AA
hex_color
A valid hexidecimal number with or without a #
Example
#FF00AA FF00AA
hostname
A valid host name
Example
www.phpinputvalidator.org
ip / ipv4
An IP v4 address.
Example
192.168.10.1
ipv6
An IP v6 address.
Example
2001:db8:85a3:0:0:8a2e:370:7334
isbn10
10 digit ISBN number
Example
90-70002-34-5
isbn13
13 digit ISBN number
Example
978-1-4028-9462-6
local_path
Local or absolute path.
Example
/www/foo/bar/
mastercard
String must be a valid Mastercard credit card.
Note
This check only validates the length and digit types. It does not check to make sure the number is actually an active card.
month_day_year
A valid month day year string
Example
05/30/2002 5/30/2002 5/30/02 5-30-02
numeric
String must only contain numbers 0-9.
Example
12345678
url
Website address. Can be http, https, or ftp.
Example
http://www.foobar.com https://www.foobar.com/bar/ http://www.foobar.com/bar/download.zip
url_dual
Website address or a local path
Example
http://www.foobar.com/bar/ http://www.foobar.com/bar/download.zip /bar/download.zip
us_currency
A valid currency number. With or without the $ and the .
Example
$5.00 $5 $3,000.33 5.00 5 3,000.33
us_phone
A valid United States phone number.
Example
1-234-567-8910 begin_of_the_skype_highlighting 1-234-567-8910 end_of_the_skype_highlighting begin_of_the_skype_highlighting 1-234-567-8910 end_of_the_skype_highlighting (123) 456-7891 123.456.7891 12345678910
us_social
A valid United States social security number.
Example
123-45-6789
us_zip
A valid United States ZIP code
Example
12345 12345-6789
visa
String must be a valid Visa credit card. This check only validates the length and digit types. It does not check to make sure the number is actually an active card.
year_month_day
A valid year month day string
Example
2002/05/30 2002/5/30