spatie / email-concealer
Conceal e-mail addresses in a string by replacing their domain
Fund package maintenance!
spatie
spatie.be/open-source/support-us
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^6.0
- spatie/phpunit-snapshot-assertions: ^0.4.1
- dev-main
- 1.0.1
- 1.0.0
- dev-analysis-3wmnlY
- dev-analysis-GD5Wpo
- dev-analysis-D29grg
- dev-analysis-yvwO5N
- dev-analysis-Yj1n7j
- dev-analysis-2QWK9l
- dev-analysis-bQndgY
- dev-analysis-7a19db
- dev-analysis-9mQLQw
- dev-analysis-ajKeKk
- dev-analysis-yvwOw2
- dev-analysis-kad3dR
- dev-analysis-L3EA7G
- dev-analysis-KZ7bvV
- dev-analysis-lKvMAk
- dev-analysis-BMJpNg
- dev-analysis-yvwOAp
- dev-analysis-m47W2a
- dev-analysis-peGw64
- dev-analysis-d0J7EJ
- dev-analysis-Yj1nNd
- dev-analysis-D29gjl
- dev-analysis-wjm6KW
- dev-analysis-d0J76J
- dev-analysis-QMg69m
- dev-analysis-QMg69P
- dev-analysis-ADNGVG
- dev-analysis-5ZwJpx
- dev-analysis-64bRkn
- dev-analysis-M1Zraj
- dev-analysis-J2Bwla
- dev-analysis-J2BwlD
- dev-analysis-rdkApZ
- dev-analysis-GD5Wnl
- dev-analysis-OMpj4l
- dev-analysis-M1ZrRO
- dev-analysis-4xPN4k
- dev-analysis-NAGy1G
- dev-analysis-orZPBp
- dev-analysis-7a19ON
- dev-analysis-Yj1nyv
- dev-analysis-0g3VlM
- dev-analysis-yvwOBL
- dev-analysis-wjm63w
This package is auto-updated.
Last update: 2024-12-21 18:43:07 UTC
README
Conceal e-mail addresses in a string
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
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('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
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 security@spatie.be 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.