Download the PHP package gremo/email-obfuscator without Composer
On this page you can find all versions of the php package gremo/email-obfuscator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gremo/email-obfuscator
More information about gremo/email-obfuscator
Files in gremo/email-obfuscator
Package email-obfuscator
Short Description A text filter for automatic email obfuscation using Javascript or CSS fallback
License MIT
Homepage http://github.com/gremo/email-obfuscator
Informations about the package email-obfuscator
Email Obfuscator
I'm not the author of this package. The original package was
propaganistas/email-obfuscator
but the author decided to abandon and delete the GitHub repository, breaking all sites using it. I've just cloned and uploaded the latest version available.
A text filter for automatic email obfuscation using the well-established JavaScript and a CSS fallback:
- ROT13 ciphering for JavaScript-enabled browsers
- CSS reversed text direction for non-JavaScript browsers
Installation
Install the bundle via Composer:
Then include the supplied JavaScript file (assets/email-obfuscator.min.js
) somewhere in your template. CND alternative (no uptime guaranteed):
Platform specific steps
- Standalone
- Laravel 5
- Twig
Standalone
Require the src/Obfuscator.php
file somewhere in your project:
Parse and obfuscate a string by using the obfuscateEmail($string)
function.
Laravel 5
You have 3 options depending on your use case:
- If you want to obfuscate all email addresses that Laravel ever outputs, add the middleare class to the
$middleware
array inApp\Http\Middleware\Kernel.php
:
This is the reccomended method.
- If you only want to have specific controller methods return obfuscated email addresses, add the Middleware class to the
$routeMiddleware
array inApp\Http\Middleware\Kernel.php
:
... and apply controller middleware as usual in a controller's construct method or route definition:
- If you want to apply obfuscation only on specific strings, just use the
obfuscateEmail($string)
function.
Twig
Add the extension to the Twig_Environment
:
The extension exposes an obfuscateEmail
Twig filter, which can be applied to any string.
Credits
- Scott Yang for the JavaScript used in this method.
- Silvan Mühlemann for the inspiration of the CSS implementation.