Skip to content
Projects

spatie/email-concealer

View on GitHub

spatie/email-concealer has 57 GitHub stars and 6 forks. GitHot measured 0 stars in 24 hours and +1 in 7 days. Last checked 2026-11-18 13:07 UTC. Last push 2026-11-06.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
+1
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

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

Developer Tools

README.md

Original

Conceal e-mail addresses in a string

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

$concealer->conceal('[email protected]');
// "[email protected]"

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

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. We publish all received postcards on our virtual postcard wall.

Postcardware

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, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards on our company website.

Installation

You can install the package via composer:

composer require spatie/email-concealer

Usage

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

use Spatie\EmailConcealer\Concealer;

$concealer = Concealer::create();

$concealer->conceal('[email protected]');
// "[email protected]"

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('[email protected],[email protected],[email protected]');
// "[email protected],[email protected],[email protected]"

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

$concealer->conceal('[email protected],[email protected],[email protected]');
// "[email protected],[email protected],[email protected]"

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('[email protected]'); // "[email protected]"

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

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.

License

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