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

1.0.1 2017-04-26 07:44 UTC

This package is auto-updated.

Last update: 2020-01-12 17:41:41 UTC


Latest Version on Packagist Build Status StyleCI Quality Score Total Downloads

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();

// ""


You're free to use this package (it's MIT-licensed), 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, Samberstraat 69D, 2060 Antwerp, Belgium.

We publish all received postcards on our company website.


You can install the package via composer:

composer require spatie/email-concealer


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

use Spatie\EmailConcealer\Concealer;

$concealer = Concealer::create();

// ""

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.

// ",,"

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

// ",,"

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

$concealer = Concealer::create()->domain('');

echo $concealer->conceal(''); // ""


Please see CHANGELOG for more information what has changed recently.


$ composer test


Please see CONTRIBUTING for details.


If you discover any security related issues, please email instead of using the issue tracker.


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.


The MIT License (MIT). Please see License File for more information.