PHPackages                             olssonm/email-address - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. olssonm/email-address

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

olssonm/email-address
=====================

Package to work with email addresses

v1.4(1mo ago)0187↓50%1MITPHPPHP ^8.2

Since Nov 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/olssonm/email-address)[ Packagist](https://packagist.org/packages/olssonm/email-address)[ RSS](/packages/olssonm-email-address/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (10)Used By (0)

Email address-parser and -builder
=================================

[](#email-address-parser-and--builder)

[![Supported PHP-versions](https://camo.githubusercontent.com/273dbaff12052e9bf24b9bd6c0f2cde39cc998d904fdc8b7ab9e56884e314088/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f6c73736f6e6d2f656d61696c2d616464726573733f7374796c653d666c61742d737175617265)](https://packagist.org/packages/olssonm/email-address)[![Latest Version on Packagist](https://camo.githubusercontent.com/972cee58b0310b4cf39b909fe260dcc1d26463229f186d6436ee1efd7ce01f3e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6c73736f6e6d2f656d61696c2d616464726573732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/olssonm/email-address)[![Build Status](https://camo.githubusercontent.com/c04336136e6541109140b425dc8606c2a33865048f398a6a3def89fb7d326901/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f6c73736f6e6d2f656d61696c2d616464726573732f746573742e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265266c6162656c3d7465737473)](https://github.com/olssonm/email-address/actions?query=workflow%3A%22Run+tests%22)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

Simple package where you can extract all the parts of an email address. Among the use cases is the retrieval of the actual delivery-address for a subaddress (i.e. "plus addressing", "tagged addressing" etc.).

Available is also an email address builder to construct an address based on parts – as well as a simple validator (using [egulias/email-validator](https://github.com/egulias/EmailValidator).)

*Note: Currently only subaddresses with `+` is supported, which is used by a vast majority of e-mail providers that support subaddressing.*

Requirements
------------

[](#requirements)

This package requires PHP 8.1 or newer.

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

[](#installation)

```
composer require olssonm/email-address

```

Usage
-----

[](#usage)

### Parser

[](#parser)

```
use Olssonm\EmailAddress\EmailAddress;

// Returns a `Olssonm\EmailAddress\Entity\EmailAddress`-instance
$email = EmailAddress::parse('test+tag@example.com');

echo $email->address;
// test+tag@example.com

echo $email->local;
// test+tag

echo $email->delivery;
// test

echo $email->tag;
// tag

echo $email->domain;
// example.com
```

### Builder

[](#builder)

```
use Olssonm\EmailAddress\EmailAddress;

// Returns a `Olssonm\EmailAddress\Entity\EmailAddress`-instance via `get()`
$email = EmailAddress::build()
    ->delivery('test')
    ->tag('tag')
    ->domain('example.com')
    ->get();

echo $email->address;
// test@example.com
```

A clever usage of the builder is the ability to change and/or remove the subaddressing-part:

```
$email = EmailAddress::build()
    ->address('test+tag@example.com')
    ->tag(null)
    ->get()

echo $email->address;
// test@example.com
```

```
$email = EmailAddress::build()
    ->address('test+tag@example.com')
    ->tag('mytag')
    ->get()

echo $email->address;
// test+mytag@example.com
```

*Note, the `address()`-method for the builder uses the parser – i.e. an exception may be thrown if the address is invalid.*

### Validator

[](#validator)

```
use Olssonm\EmailAddress\EmailAddress;

// true
EmailAddress::validate('test@example.com');
```

### Exceptions

[](#exceptions)

If an invalid e-mail address is parsed, an `Olssonm\EmailAddress\Exceptions\InvalidEmailAddressException` will be thrown. A good idea is to validate the e-mail address before parsing it.

License
-------

[](#license)

The MIT License (MIT). Please see the [LICENSE](LICENSE) for more information.

© 2023 [Marcus Olsson](https://marcusolsson.me).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance50

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~306 days

Total

5

Last Release

59d ago

PHP version history (2 changes)v1.0PHP ^8

v1.4PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/74a309aadadeae81baef2394d37375673d03f11133b28a831a30825361d1d68c?d=identicon)[olssonm](/maintainers/olssonm)

---

Top Contributors

[![olssonm](https://avatars.githubusercontent.com/u/907114?v=4)](https://github.com/olssonm "olssonm (15 commits)")

###  Code Quality

TestsPest

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/olssonm-email-address/health.svg)

```
[![Health](https://phpackages.com/badges/olssonm-email-address/health.svg)](https://phpackages.com/packages/olssonm-email-address)
```

###  Alternatives

[wallabag/wallabag

open source self hostable read-it-later web application

12.6k2.2k](/packages/wallabag-wallabag)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[serendipity_hq/component-value-objects

A set of value objects to manage simple and composite values

20558.6k4](/packages/serendipity-hq-component-value-objects)[yosimitso/workingforumbundle

A complete forum bundle

425.3k](/packages/yosimitso-workingforumbundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
