Documentation

This commit is contained in:
bkrukowski 2016-10-14 21:15:15 +02:00
parent 93ff214003
commit 5dd7f4d0fb

View File

@ -23,13 +23,17 @@ To detect multi-accounts on your website.
```php ```php
use bkrukowski\TransparentEmail\TransparentEmailFactory; use bkrukowski\TransparentEmail\TransparentEmailFactory;
use bkrukowski\TransparentEmail\Emails\Email; use bkrukowski\TransparentEmail\Emails\Email;
use bkrukowski\TransparentEmail\Emails\EmailInterface;
use bkrukowski\TransparentEmail\Emails\InvalidEmailException; use bkrukowski\TransparentEmail\Emails\InvalidEmailException;
try { try {
$cleaner = TransparentEmailFactory::createDefault(); $cleaner = TransparentEmailFactory::createDefault();
$transformedEmail = $cleaner->getPrimaryEmail(new Email('John.Doe+alias@gmail.com')); $inputEmail = new Email('John.Doe+alias@gmail.com');
/** @var EmailInterface $transformedEmail */
$transformedEmail = $cleaner->getPrimaryEmail($inputEmail);
echo $transformedEmail;
} catch (InvalidEmailException $exception) { } catch (InvalidEmailException $exception) {
// do something echo 'Invalid email!';
} }
``` ```