The key to a stable and secure application or website is data validation. Validating things like email addresses, numbers, and other data can be very time consuming and add a lot of extra lines of code to your website if you want to do it the right way. This class can make the data validation part of website development a lot easier.
This class is very easy to use. Because all the methods are static they are faster and callable without instantiating the class. This will say that you only need to include the PHP file in your code and do the validations like below. The method returns a boolean (true when it’s valid, false when invalid). To show you some examples:
Email validation:
if(!Validator::Email("wim(at)test.com")){ echo "Your email is invalid"; }
Email validation and don’t accept addresses that end with test.com or test.be:
if(!Validator::Email("wim(at)test.com", array("test.com", "test.be"))){ echo "Your email is invalid"; }
Check if a number is between 20 and 50:
if(!Validator::Number(35, 50, 20)){ echo "The number is not between 20 and 50"; }
Check if a user is older than 18:
if(!Validator::OlderThan("1966-2-5", 17)){ echo "You must be older than 18."; }
Features
- Url
- IP
- Phone numbers
- Number (extra parameter to check if the number is between min and max)
- Unsigned Number
- Float
- Alpha
- Alpha numeric
- String length is between min and max characters
- Hexcolor
- Date
- Check if someone born on date x is older than x years
- Valid XML
- Filesize between min and max bytes
- Image dimensions between width is beween min and max and/or height is between min and max pixels
Updates
13/12/2009:
- Added chars validation
- Fixed Alpha method typo
18/11/2009:
- Added phone number validation
- Fixed wrong images
[eltd_button size=”huge-full-width” type=”outline” text=”Download & Demo Links” custom_class=”#” icon_pack=”font_awesome” fa_icon=”” link=”” target=”_blank” color=”” hover_color=”” background_color=”” hover_background_color=”” border_color=”” hover_border_color=”” font_size=”” font_weight=”” margin=””]
Demo = Data Validation class
[eltd_button size=”huge” type=”” text=”Full Live Demo” custom_class=”” icon_pack=”font_awesome” fa_icon=”fa-laptop” link=”https://codecanyon.net/item/data-validation-class/70008″ target=”_blank” color=”” hover_color=”” background_color=”” hover_background_color=”” border_color=”” hover_border_color=”” font_size=”” font_weight=”” margin=””]
Kindly Note: We update new contents like WordPress Themes, Plugins, PHP Scripts everyday. But remember that you should never use this items in a commercial website. All the contents posted here for development & testing purpose only. We’re not responsible for any damage, use at your own RISK! We highly recommend to buy Data Validation class from the The Developer ( Sitebase ) website. Thank you.
Download = Data Validation class-[Updated].zip