PHPackages                             donchev/email-extractor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. donchev/email-extractor

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

donchev/email-extractor
=======================

Extract valid email addresses from a string or array of strings.With a few helper methods like sortAsc/sortDesc, unique,filterInclude/filterExclude, lowercase/uppercase included.

1.0.1(3y ago)3539MITPHPPHP &gt;=7.1

Since Oct 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/vdonchev/email-extractor)[ Packagist](https://packagist.org/packages/donchev/email-extractor)[ RSS](/packages/donchev-email-extractor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Email Extractor
===============

[](#email-extractor)

Extract in `array` ALL valid email addresses from a `string` or `string array`. This library also includes a few helper methods to modify the output array.

Installation
------------

[](#installation)

`composer require donchev/email-extractor`

Object Instantiation
--------------------

[](#object-instantiation)

`EmailExtractor` object accept 2 optional parameters in it's `__constructor()` method:

- `array|null $filter` An array of words used for filtering matched emails. If not passed to the constructor, an empty `array` is used when/if `filterAsc()` or `filterDesc()` is called.
- `string|null $regex` A valid regex that match an email address. If not passed to the constructor, the default build-in regex will be used. **(NOTE: It is recommended to use the build-in regex, except if you know what you are doing.)**

Simple Usage
------------

[](#simple-usage)

```
