EasyValidation is a PHP library that provides simple and easy-to-use validation functions for common types of data, such as email addresses, URLs, numbers, and dates.
The recommended way to install EasyValidation is via Composer:
composer require qdenka/easy-validation
use QDenka\EasyValidation\Infrastructure\Validator;
if (Validator::isValidEmail('[email protected]')) {
echo 'Valid email address';
} else {
echo 'Invalid email address';
}
use QDenka\EasyValidation\Infrastructure\Validator;
if (Validator::isValidUrl('http://www.example.com')) {
echo 'Valid URL';
} else {
echo 'Invalid URL';
}
use QDenka\EasyValidation\Infrastructure\Validator;
if (Validator::isValidNumber('123')) {
echo 'Valid number';
} else {
echo 'Invalid number';
}
use QDenka\EasyValidation\Infrastructure\Validator;
if (Validator::isValidDate('2023-04-23')) {
echo 'Valid date';
} else {
echo 'Invalid date';
}
Contributions are welcome! Please open an issue or a pull request if you find a bug or want to suggest an improvement.