beastbytes / yii2-emailobfuscator
Yii2 Widget to obfuscate email addresses
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-12-19 10:01:09 UTC
README
Yii2 Widget to obfuscate email addresses to help prevent harvesting by spam bots.
The widget outputs either a message or an obfuscated version of the address as the text into the document. If JavaScript is enabled that text is replaced with a mailto link.
For license information see the LICENSE file.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist beastbytes/yii2-microformats
or add
"beastbytes/yii2-emailobfuscator": "~1.0.0"
to the require section of your composer.json.
Usage
Use this extension in a view.
To output the default message ("This e-mail address is protected to prevent harvesting by spam-bots")
$emailAddress = EmailObfuscator::widget([ 'address' => 'my.address@example.com' ]);
To output the email address as an obfuscated version: "my dot address at example dot com"
$emailAddress = EmailObfuscator::widget([ 'address' => 'my.address@example.com', 'obfuscators' => [' dot ', ' at '] ]);