PHP code example of pandawan-technology / email-transformer

1. Go to this page and download the library: Download pandawan-technology/email-transformer 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/ */

    

pandawan-technology / email-transformer example snippets




use PandawanTechnology\EmailTransformer\EmailAddressTransformer;

class MyService 
{
    /**
     * @var EmailAddressTransformer 
     */
    private $emailAddressTransformer;
    
    public function __construct(EmailAddressTransformer $emailAddressTransformer) 
    {
        $this->emailAddressTransformer = $emailAddressTransformer;
    }
    
    public function __invoke($address) 
    {
        $address = $this->emailAddressTransformer->transformUnique($address);
        // Will output an (Named)Address instance depending on the provided input
    }
}



use PandawanTechnology\EmailTransformer\EmailAddressTransformer;

class MyService 
{
    /**
     * @var EmailAddressTransformer 
     */
    private $emailAddressTransformer;
    
    public function __construct(EmailAddressTransformer $emailAddressTransformer) 
    {
        $this->emailAddressTransformer = $emailAddressTransformer
    }
    
    public function __invoke($addresses) 
    {
        $addresses = $this->emailAddressTransformer->transform($addresses);
        // Will output an (Named)Address array instance(s) depending on the provided input
    }
}