PHPackages                             pfarrer/yii2-email-obfuscator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pfarrer/yii2-email-obfuscator

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

pfarrer/yii2-email-obfuscator
=============================

Yii2 extension to obfuscate eMail addresses.

07.8k↓50%[1 issues](https://github.com/Pfarrer/yii2-email-obfuscator/issues)PHP

Since Aug 17Pushed 11y ago1 watchersCompare

[ Source](https://github.com/Pfarrer/yii2-email-obfuscator)[ Packagist](https://packagist.org/packages/pfarrer/yii2-email-obfuscator)[ RSS](/packages/pfarrer-yii2-email-obfuscator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-email-obfuscator
=====================

[](#yii2-email-obfuscator)

Email obfuscatior plugin for Yii2.

This plugin combines some Email obfuscation technics.

- The @ char is removed and only its index is passed on. It will be reinserted using the expression String.fromCharCode(4*2*2\*4).
- The address itself will be transmitted as a ROT13 transformed string which will be retransformed by Javascript.
- The "mailto:" prefix is decoded as a reversed string which gets unreversed by Javascript.

The Email address "" will result in the following code:

```

var action=":otliam".split("").reverse().join("");
var href="znvyrknzcyr.pbz".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c=(c=c.charCodeAt(0)+13)?c:c-26);});
href=href.substr(0, 4) + String.fromCharCode(4*2*2*4) + href.substr(4);
var a = ""+href+"";
document.write(a);

```

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require "pfarrer/yii2-email-obfuscator" "dev-master"

```

or add

```
"pfarrer/yii2-email-obfuscator": "dev-master"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Simply insert this in your template:

```
