diff --git a/README.md b/README.md index 262693b..c0ab3e6 100644 --- a/README.md +++ b/README.md @@ -9,46 +9,58 @@ With the help of Run the command below to install via Composer ```shell -composer require egulias/email-validator +composer require egulias/email-validator "~2.0" ``` -##Usage## +##Getting Started## +`EmailValidator`requires you to decide which (or combination of them) validation/s strategy/ies you'd like to follow for each [validation](#available-validations). -Simple example: +A basic example with the RFC validation +```php +isValid("example@example.com", new RFCValidation()) //true +``` + + +###Available validations### + +1. [RFCValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/RFCValidation.php) +2. [NoWarningsRFCValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/NoRFCWarningsValidation.php) +3. [DNSCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/DNSCheckValidation.php) +4. [SpoofCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/SpoofCheckValidation.php) +5. [MultipleValidationsWithAnd](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/MultipleValidationWithAnd.php) +6. [Your own validation](#how-to-extend) + +`MultipleValidationsWithAnd` + +It is a validation that operates over other validations performing a logical and (&&) over the result of each validation. ```php isValid($email)) { - echo $email . ' is a valid email address'; -} +$validator = new EmailValidator(); +$multipleValidations = new MultipleValidationsWithAnd([ + new RFCValidation(), + new DNSCheckValidation() +]) +$validator->isValid("example@example.com", $multipleValidations) //true ``` -More advanced example (returns detailed diagnostic error codes): +###How to extend### -```php -isValid($email); +##Other Contributors## +(You can find current contributors [here](https://github.com/egulias/EmailValidator/graphs/contributors)) -if ($result) { - echo $email . ' is a valid email address'; -} else if ($validator->hasWarnings()) { - echo 'Warning! ' . $email . ' has unusual/deprecated features (result code ' . var_export($validator->getWarnings(), true) . ')'; -} else { - echo $email . ' is not a valid email address (result code ' . $validator->getError() . ')'; -} -``` - -##Contributors## -As this is a port from another library and work, here are other people related to the previous: +As this is a port from another library and work, here are other people related to the previous one: * Ricard Clau [@ricardclau](http://github.com/ricardclau): Performance against PHP built-in filter_var * Josepf Bielawski [@stloyd](http://github.com/stloyd): For its first re-work of Dominic's lib