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

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

spatie/email-concealer
======================

Conceal e-mail addresses in a string by replacing their domain

1.0.1(9y ago)5613061MITPHPPHP ^7.1CI passing

Since Apr 21Pushed 5mo ago4 watchersCompare

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

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

Conceal e-mail addresses in a string
====================================

[](#conceal-e-mail-addresses-in-a-string)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d2569cf500e6640e0e5c78ef0c61fdd5f7dbea23787f84caafb27e4e82b13f1f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f656d61696c2d636f6e6365616c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/email-concealer)[![Build Status](https://camo.githubusercontent.com/7bbf869fa23db12b9e29bcae9139843c24c8f7b91b738b2bdf15ace6c1a0c3c7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7370617469652f656d61696c2d636f6e6365616c65722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/spatie/email-concealer)[![StyleCI](https://camo.githubusercontent.com/c3e89c97bd9a612ad657f6f42e51056499d6213da4438fcd45e6db31110f7ab1/68747470733a2f2f7374796c6563692e696f2f7265706f732f38383838363036312f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/88886061)[![Quality Score](https://camo.githubusercontent.com/748ad0574b3b0fc195fd06c963b297c411286ce875b2c369ebc3791319ecc213/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7370617469652f656d61696c2d636f6e6365616c65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/spatie/email-concealer)[![Total Downloads](https://camo.githubusercontent.com/0f1a0230905c1078f7ac46dc798fa7ee25d473b2d664535bc920abbda80e9d7b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f656d61696c2d636f6e6365616c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/email-concealer)

Conceal e-mail addresses in a string by replacing their domain. Useful for concealing up production data—like MySQL dumps—so you can use it locally without worrying about having real addresses on your system.

```
use Spatie\EmailConcealer\Concealer;

$concealer = Concealer::create();

$concealer->conceal('info@spatie.be');
// "info@example.com"
```

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/7cff29ecf1b766820b67854a5e7a59152f80d33a318e8a5b9289c9f707773501/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f656d61696c2d636f6e6365616c65722e6a70673f743d31)](https://spatie.be/github-ad-click/email-concealer)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Postcardware
------------

[](#postcardware)

You're free to use this package (it's [MIT-licensed](LICENSE.md)), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards [on our company website](https://spatie.be/en/opensource/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require spatie/email-concealer
```

Usage
-----

[](#usage)

To conceal a string, create an `Concealer` instance. and call the `conceal` method.

```
use Spatie\EmailConcealer\Concealer;

$concealer = Concealer::create();

$concealer->conceal('info@spatie.be');
// "info@example.com"
```

The concealer processes every e-mail address it finds in the string. It will ensure that there aren't any unwanted duplicates if the local-part is the same.

```
$concealer->conceal('info@spatie.be,info@foo.com,info@bar.com');
// "info@example.com,info-1@foo.com,info-2@bar.com"
```

Equal e-mail addresses will always conceal to the same concealed address.

```
$concealer->conceal('info@spatie.be,info@foo.com,info@spatie.be');
// "info@example.com,info-1@example.com,info@example.com"
```

If you want to use a different domain than `example.com`, use the `domain` method to set a new one.

```
$concealer = Concealer::create()->domain('foo.com');

echo $concealer->conceal('info@spatie.be'); // "info@foo.com"
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Sebastian De Deyne](https://github.com/sebastiandedeyne)
- [All Contributors](../../contributors)

About Spatie
------------

[](#about-spatie)

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

License
-------

[](#license)

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

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance50

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~4 days

Total

2

Last Release

3352d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (13 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (9 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (5 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (2 commits)")[![mrk-j](https://avatars.githubusercontent.com/u/1250622?v=4)](https://github.com/mrk-j "mrk-j (1 commits)")[![patinthehat](https://avatars.githubusercontent.com/u/5508707?v=4)](https://github.com/patinthehat "patinthehat (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

developer-toolsemailobfuscationsecurityspatiedataobfuscateemailsconcealemail-concealer

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-failed-job-monitor

Get notified when a queued job fails

1.0k2.7M4](/packages/spatie-laravel-failed-job-monitor)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4432.4M16](/packages/spatie-url-signer)[spatie/laravel-url-signer

Laravel implementation of spatie/signed-url

719825.7k3](/packages/spatie-laravel-url-signer)[spatie/laravel-server-monitor

Monitor servers

844291.4k6](/packages/spatie-laravel-server-monitor)[spatie/laravel-database-mail-templates

Render Laravel mailables using a template stored in the database.

445805.1k7](/packages/spatie-laravel-database-mail-templates)[spatie/mjml-php

Convert MJML to HTML using PHP

280836.4k11](/packages/spatie-mjml-php)

PHPackages © 2026

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