ricardosierra / validate
Validate is a PHP library that validate and filter data for you.
Fund package maintenance!
ricasolucoes
ricasolucoes.com.br/open-source/support-us
Requires
- php: ^7.2|^8.0
- fakerphp/faker: ^1.5
- guzzlehttp/guzzle: ^6.0|^7.0|^8.0
- nesbot/carbon: >=2.0|1.*
Requires (Dev)
- ext-intl: *
- phpro/grumphp: ^1.3
- phpunit/phpunit: >=4.0
- psalm/plugin-laravel: ^1.5
This package is auto-updated.
Last update: 2024-12-16 05:22:14 UTC
README
This package provides a pure PHP validator for field in differents formats
Requirements:
- PHP 7.0+
- Composer
Installation
You can install this library via Composer: composer require ricardosierra/validate
Examples
Validate Full Name
<?php \Validate\Name::validate('Ricardo Sierra'); // True \Validate\Name::validate('Ricardo'); // False \Validate\Name::validate('Ricardo 123'); // False \Validate\Name::validate('Teste Sierra'); // False
Validando Senhas Comuns
<?php \Validate\Password::validate('RHMVbymY45JWar5A'); // True \Validate\Password::validate('3?=4dB#%zNGaXH_P'); // True \Validate\Password::validate('123456'); // False \Validate\Password::validate('Ricardo'); // False
Validate Email
<?php use Validate\Email; // Initialize library class $mail = new Email(); // Set the timeout value on stream $mail->setStreamTimeoutWait(20); // Set debug output mode $mail->Debug= TRUE; $mail->Debugoutput= 'html'; // Set email address for SMTP request $mail->setEmailFrom('from@email.com'); // Email to check $email = 'email@example.com'; // Check if email is valid and exist if($mail->check($email)){ echo 'Email <'.$email.'> is exist!'; }elseif(Email::validate($email)){ echo 'Email <'.$email.'> is valid, but not exist!'; }else{ echo 'Email <'.$email.'> is not valid and not exist!'; } ?>
Contributing
For contributing guidelines, please see CONTRIBUTING.md