PHP code example of kozz / email-address-parser

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

    

kozz / email-address-parser example snippets


    use Kozz\Components\Email\AddressParser;
    
    $emails = '[email protected] , [email protected] [email protected]';
    $array = AddressParser::parse($emails)->toArray();
    //$array = ['[email protected]','[email protected]', '[email protected]']

    use Kozz\Components\Email\AddressParser;
    
    $emails = 'john@, aaron@, [email protected]';
    $array = AddressParser::parse($emails, 'company.com')->toArray();
    //$array = ['[email protected]', '[email protected]', '[email protected]']

    use Kozz\Components\Email\AddressParser;
    
    $emails = 'john@, [email protected], ... skjs  sljfasfn afs, jhsldf.sdfjk"""85;@#$ ';
    $array = AddressParser::parse($emails, 'company.com')->toArray();
    //$array = ['[email protected]', '[email protected]']