Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 2.16 KB

README.md

File metadata and controls

55 lines (40 loc) · 2.16 KB

PHP Email Address Parser

Build Status Coverage Status Scrutinizer Code Quality Latest Stable Version Latest Unstable Version License

Library that allows you simply parse your email addresses from string or array and autocomplete domain name if needed.

Installation

Add the package to your composer.json and run composer update.

{
    "require": {
        "kozz/email-address-parser": "*"
    }
}

Examples

Parse String

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

Autocomplete domain

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

Built-in email validation

    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]']