PHPackages                             componenta/email - 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. componenta/email

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

componenta/email
================

Email value object

v1.0.0(1mo ago)01MITPHPPHP ^8.4

Since Jun 16Pushed 1mo agoCompare

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

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Componenta Email
================

[](#componenta-email)

Immutable email address value object with validation, normalization, masking, domain helpers, and JSON/string serialization.

Use it at application boundaries where a validated email address should be represented as a typed value instead of a raw string.

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

[](#installation)

```
composer require componenta/email
```

Requires the `mbstring` extension.

Related Packages
----------------

[](#related-packages)

This package validates email values without neighboring Componenta packages.

PackageWhy it may be used nearby`componenta/validation`Validates user input before creating `Email`.`componenta/auth`Can use email for login, password reset, or magic-link flows.`componenta/cqrs`Commands can type email fields with this value object.Usage
-----

[](#usage)

```
use Componenta\Stdlib\Email;

$email = Email::fromString('Ada@Example.COM');

(string) $email;        // "ada@example.com"
$email->local;          // "ada"
$email->domain;         // "example.com"
$email->isFromDomain('example.com'); // true
$email->masked();       // "ad*@example.com"
```

Validation
----------

[](#validation)

`new Email()` and `Email::fromString()` throw `InvalidArgumentException` when:

- the address is empty
- the address is not accepted by `FILTER_VALIDATE_EMAIL`
- the full address exceeds 254 characters
- the local part exceeds 64 characters
- the domain exceeds 253 characters

Use `Email::tryFromString()` when invalid input should produce `null`.

Normalization
-------------

[](#normalization)

The constructor trims whitespace, removes invisible control characters, and lowercases both local and domain parts. The stored `value`, `__toString()`, and `jsonSerialize()` all return the normalized address.

Helpers
-------

[](#helpers)

- `equals()` compares normalized addresses
- `tld()` returns the last domain segment
- `isFromDomain()` performs case-insensitive domain comparison
- `masked()` returns a log/UI-safe representation

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance91

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

43d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20490712?v=4)[Andrey Shelamkoff](/maintainers/Shelamkoff)[@Shelamkoff](https://github.com/Shelamkoff)

---

Top Contributors

[![Shelamkoff](https://avatars.githubusercontent.com/u/20490712?v=4)](https://github.com/Shelamkoff "Shelamkoff (1 commits)")

###  Code Quality

TestsPest

### Embed Badge

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

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

PHPackages © 2026

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