PHP code example of phil / email-address-bundle

1. Go to this page and download the library: Download phil/email-address-bundle 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/ */

    

phil / email-address-bundle example snippets


// config/bundles.php
Phil\EmailAddressBundle\PhilEmailAddressBundle::class => ['all' => true],

use Phil\EmailAddressBundle\Infrastructure\Form\EmailAddressType;

$builder->add('email', EmailAddressType::class, ['list' => 'staff']);

use Phil\EmailAddressBundle\Domain\BounceDecision;
use Phil\EmailAddressBundle\Domain\Event\BounceDecided;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

#[AsEventListener]
final readonly class SuspendBouncedAddresses
{
    public function __invoke(BounceDecided $event): void
    {
        if (BounceDecision::Suspend === $event->decision) {
            // Stop sending to $event->notice->address, or to the recipient $event->notice->recipientId.
        }
    }
}