-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ PHP Email Address Parser | |
[![Latest Unstable Version](https://poser.pugx.org/kozz/email-address-parser/v/unstable.svg)](https://packagist.org/packages/kozz/email-address-parser) | ||
[![License](http://img.shields.io/packagist/l/kozz/email-address-parser.svg)](https://packagist.org/packages/kozz/email-address-parser) | ||
|
||
Library that allows you simply parse your email addresses from string or array and autocomplete domain name if needed. | ||
|
||
Installation | ||
------------ | ||
|
||
|
@@ -18,3 +20,30 @@ Add the package to your `composer.json` and run `composer update`. | |
"kozz/email-address-parser": "*" | ||
} | ||
} | ||
|
||
Examples | ||
-------- | ||
|
||
#### Parse String | ||
|
||
```php | ||
$emails = '[email protected] , [email protected] [email protected]'; | ||
$array = AddressParser::parse($emails)->toArray(); | ||
//$array = ['[email protected]','[email protected]', '[email protected]'] | ||
``` | ||
|
||
#### Autocomplete domain | ||
|
||
```php | ||
$emails = 'john@, aaron@, [email protected]'; | ||
$array = AddressParser::parse($emails, 'company.com')->toArray(); | ||
//$array = ['[email protected]', '[email protected]', '[email protected]'] | ||
``` | ||
|
||
#### Built-in email validation | ||
|
||
```php | ||
$emails = 'john@, [email protected], ... skjs sljfasfn afs, jhsldf.sdfjk"""85;@#$ '; | ||
$array = AddressParser::parse($emails, 'company.com')->toArray(); | ||
//$array = ['[email protected]', '[email protected]'] | ||
``` |