Download the PHP package jdz/obfuscator without Composer
On this page you can find all versions of the php package jdz/obfuscator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jdz/obfuscator
More information about jdz/obfuscator
Files in jdz/obfuscator
Package obfuscator
Short Description Server-side email obfuscation paired with the jizy-obfuscator JS client
License MIT
Homepage https://jdz.joffreydemetz.com/obfuscator
Informations about the package obfuscator
jdz/obfuscator
Server-side email obfuscation paired with the jizy-obfuscator JS client.
Emits indexed <span id="obfuscated-N"> placeholders and ROT13-encoded HTML payloads; the JS client reveals the real markup in the DOM on page load.
Installation
Requirements
- PHP 8.2 or higher
- twig/twig ^3.0
Usage
Runnable samples live in examples/ (01-basic-usage.php, 02-twig-integration.php).
PHP
Twig
API
Obfuscator
| Method | Returns |
|---|---|
obfuscate(string $email, ?string $label = null, array $attrs = []) |
placeholder <span> |
obfuscateHtml(string $html) |
placeholder <span> |
getPayloads(): string[] |
ROT13-encoded payloads, ordered by index |
renderScript(): string |
<script>window.Obfuscator.decode([...])</script> — empty when nothing registered |
reset(): void |
clears collected payloads |
The encoding itself is JDZ\Obfuscator\Rot13::convert(string $s): string.
Twig extension
- Filter
obfuscate(attrs = {}) - Function
obfuscate_email(email, label = null, attrs = {}) - Function
obfuscate_html(html) - Function
obfuscate_script()
All filter/function outputs are marked is_safe: html.
Client-side
Install and load jizy-obfuscator. Placeholder ids (#obfuscated-0, #obfuscated-1, ...) match the order of the payloads array passed to Obfuscator.decode, which is exactly the order returned by getPayloads() here.
Testing
License
MIT - see LICENSE