smorken/obfuscate

Obfuscation library

v9.0 2022-02-04 15:35 UTC

This package is auto-updated.

Last update: 2024-12-01 00:12:16 UTC


README

License

This software is open-sourced software licensed under the MIT license

Requirements

  • PHP 7.2+

Works in conjunction with the smorken-obfuscate javascript library.

$ npm install smorken-obfuscate
Examples
<?php
$emails = ['foo@example.org', 'bar@example.org', 'fizbuz@example.net'];
$ob = new \Smorken\Obfuscate\Obfuscate();
foreach ($emails as $email): ?>
    <a class="clr" data-smob="<?php echo $ob->obfuscate($email); ?>" data-smob-overwrite data-smob-prepend="mailto:"></a>
<?php endforeach; ?>
<script src="assets/js/smob.var.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
    var smob = new SmOb.Obfuscate();
    var smobdom = new SmOb.Dom(smob);
    smobdom.handle(document.querySelectorAll('.clr'), 'clear');
});
</script>