PHP code example of bkrukowski / transparent-email

1. Go to this page and download the library: Download bkrukowski/transparent-email library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bkrukowski / transparent-email example snippets


use bkrukowski\TransparentEmail\TransparentEmailFactory;
use bkrukowski\TransparentEmail\Emails\Email;
use bkrukowski\TransparentEmail\Emails\EmailInterface;
use bkrukowski\TransparentEmail\Emails\InvalidEmailException;

try {
    $factory = new TransparentEmailFactory();
    $cleaner = $factory->createDefault();
    $inputEmail = new Email('[email protected]');
    /** @var EmailInterface $transformedEmail */
    $transformedEmail = $cleaner->getPrimaryEmail($inputEmail);
    echo $transformedEmail;
} catch (InvalidEmailException $exception) {
    echo 'Invalid email!';
}