PHPackages                             mokhosh/muddle - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. mokhosh/muddle

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

mokhosh/muddle
==============

Obfuscate emails and strings in PHP and Laravel

v4.0.0(7mo ago)7912.7k↓67.9%8[3 PRs](https://github.com/mokhosh/muddle/pulls)MITPHPPHP ^8.2CI passing

Since Nov 1Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/mokhosh/muddle)[ Packagist](https://packagist.org/packages/mokhosh/muddle)[ Docs](https://github.com/mokhosh/muddle)[ GitHub Sponsors]()[ RSS](/packages/mokhosh-muddle/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (6)Dependencies (8)Versions (10)Used By (0)

Muddle: Obfuscate, Obscure, Confuse, Jumble, Complicate, Perplex
================================================================

[](#muddle-obfuscate-obscure-confuse-jumble-complicate-perplex)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6866896bf5c4ce2f7c68dd118f182c0923fe229d88b59055047f7f1d331316da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f6b686f73682f6d7564646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mokhosh/muddle)[![GitHub Tests Action Status](https://camo.githubusercontent.com/93a8f8cb711b68d7b8dc101fd6808a5aa1aa30066948ce3c9afd8697dfc1aed4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f6b686f73682f6d7564646c652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mokhosh/muddle/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/a6506a37be22e8739f4b207bd29de5856929b9deee42ffc2c4207fcbad501e40/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f6b686f73682f6d7564646c652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/mokhosh/muddle/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/3650dea66ecc2db5e8983c7777a252d89d8c0f41102f00ebbd34cf8d484f0095/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f6b686f73682f6d7564646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mokhosh/muddle)

Please, don't just put plain raw emails on your web pages. Bots are going to scrape your pages and fill all of our inboxes with spam emails.

Obfuscate emails and strings in PHP and Laravel to keep those nasty bots away from finding your email or worse, your users' emails.

This package uses different strategies to obfuscate clickable and non-clickable emails, so you can choose what suits your needs best.

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

[](#installation)

You can install the package via composer:

```
composer require mokhosh/muddle
```

Usage
-----

[](#usage)

In Laravel Projects:

```
{{-- instead of handing your emails to spammers like this: --}}
{{ $user->name }}

{{-- do this: --}}

{{-- and we will confuscate the email in random ways to make it impossible for bots to steal your emails --}}

{{-- default strategy components based on config --}}
 {{-- muddled email link --}}
 {{-- muddled email text --}}

{{-- specific link strategy components --}}
 {{-- picks a random strategy each time --}}

{{-- specific text strategy components --}}
 {{-- picks a random strategy each time --}}

```

```
use Mokhosh\Muddle\Facades\Muddle;
use Mokhosh\Muddle\Strategies\Text;
use Mokhosh\Muddle\Strategies\Link;

// default strategy
Muddle::text('test@example.com');
Muddle::link('test@example.com');

// specific strategy
Muddle::strategy(text: new Text\Encrypt)->text('test@example.com')
Muddle::strategy(link: new Link\Encrypt)->link('test@example.com');
```

In plain PHP Projects:

```
use Mokhosh\Muddle\Muddle;
use Mokhosh\Muddle\Strategies\Text;
use Mokhosh\Muddle\Strategies\Link;

$muddle = new Muddle(
    text: new Text\Random,
    link: new Link\Random,
);

$muddle->link('test@example.com');
```

Automatic Title Obfuscation
---------------------------

[](#automatic-title-obfuscation)

When using the `link` method or component, if the `email` and `title` attributes are identical (for example, ``), the title will be automatically obfuscated using the text strategy. This prevents the email from being exposed in plain text. Please note that this automatic behavior only applies for the default strategy. If you are using a specific strategy you will need to handle this scenario manually.

Configuration
-------------

[](#configuration)

You can publish the config file with:

```
php artisan vendor:publish --tag="muddle-config"
```

This is the contents of the published config file:

```
return [

    /*
    |--------------------------------------------------------------------------
    | Default Strategy
    |--------------------------------------------------------------------------
    |
    | Set default strategies for obfuscating text and email links
    |
    */
    'strategy' => [
        'text' => \Mokhosh\Muddle\Strategies\Text\Random::class,
        'link' => \Mokhosh\Muddle\Strategies\Link\Random::class,
    ],

];
```

Testing
-------

[](#testing)

```
composer test
```

Todo
----

[](#todo)

- Add Dusk tests
- Make loading components dynamic

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mo Khosh](https://github.com/mokhosh)
- [Joe Tannenbaum](https://github.com/joetannenbaum/obfuscate) for the inspiration.
- [Spencer Mortensen](https://spencermortensen.com/articles/email-obfuscation) for the information.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance76

Regular maintenance activity

Popularity40

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~72 days

Recently: every ~90 days

Total

6

Last Release

237d ago

Major Versions

v0.0.1 → v1.0.02024-11-03

v1.0.0 → v2.0.02024-11-03

v2.0.0 → v3.0.02024-11-04

v3.1.0 → v4.0.02025-10-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/939919859a4e4f8e56b5771bc355135f44d98d8a3926baa6ce4358d2dc090edf?d=identicon)[mokhosh](/maintainers/mokhosh)

---

Top Contributors

[![mokhosh](https://avatars.githubusercontent.com/u/6499685?v=4)](https://github.com/mokhosh "mokhosh (110 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")[![RChutchev](https://avatars.githubusercontent.com/u/11131666?v=4)](https://github.com/RChutchev "RChutchev (2 commits)")[![adin00](https://avatars.githubusercontent.com/u/5090259?v=4)](https://github.com/adin00 "adin00 (1 commits)")

---

Tags

emailencryptionlaravelobfuscationphpsecuritystringlaravelMo Khoshmuddle

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mokhosh-muddle/health.svg)

```
[![Health](https://phpackages.com/badges/mokhosh-muddle/health.svg)](https://phpackages.com/packages/mokhosh-muddle)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.3M42](/packages/spatie-laravel-pdf)[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M152](/packages/spatie-laravel-health)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24855.3k](/packages/vormkracht10-laravel-mails)[xammie/mailbook

Laravel Mail Explorer

483519.8k1](/packages/xammie-mailbook)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)[backstage/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24875.5k8](/packages/backstage-laravel-mails)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
