PHPackages                             opiy-org/laravel-sanitized - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. opiy-org/laravel-sanitized

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

opiy-org/laravel-sanitized
==========================

Clean html in eloquent model fields on saving

1.1.3(4y ago)0358[1 PRs](https://github.com/opiy-org/laravel-sanitized/pulls)MITPHPPHP ^7.4|^8.0

Since Nov 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/opiy-org/laravel-sanitized)[ Packagist](https://packagist.org/packages/opiy-org/laravel-sanitized)[ Docs](https://github.com/opiy-org/laravel-sanitized)[ RSS](/packages/opiy-org-laravel-sanitized/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (11)Versions (8)Used By (0)

Laravel-sanitized
=================

[](#laravel-sanitized)

[![Latest Stable Version](https://camo.githubusercontent.com/65bd58fde5d8ecef99143394b62f79085e2f0a93a4227190580026f4e87b8350/687474703a2f2f706f7365722e707567782e6f72672f6f7069792d6f72672f6c61726176656c2d73616e6974697a65642f76)](https://packagist.org/packages/opiy-org/laravel-sanitized)[![GitHub latest commit](https://camo.githubusercontent.com/4287e87d6e8e639db9a3dbc8b0a16701e7166034bda77f24f48facc5e15fd9a1/68747470733a2f2f62616467656e2e6e65742f6769746875622f6c6173742d636f6d6d69742f6f7069792d6f72672f6c61726176656c2d73616e6974697a6564)](https://GitHub.com/opiy-org/laravel-sanitized/commit/)[![Packagist](https://camo.githubusercontent.com/18332c567183d497ed6b735406dc316b38107736a380096944e3fecfed85658f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6f7069792d6f72672f6c61726176656c2d73616e6974697a65642e7376673f7374796c653d666c6174)](https://packagist.org/packages/opiy-org/laravel-sanitized/)[![GitHub Actions](https://github.com/opiy-org/laravel-sanitized/actions/workflows/main.yml/badge.svg)](https://github.com/opiy-org/laravel-sanitized/actions/workflows/main.yml/badge.svg)

Clean html in eloquent model fields on saving

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

[](#installation)

You can install the package via composer:

```
composer require opiy-org/laravel-sanitized
```

Publish config file

```
php artisan vendor:publish --provider=OpiyOrg\LaravelSanitized\LaravelSanitizedServiceProvider"
```

Usage
-----

[](#usage)

Just add trait to your models:

```
use OpiyOrg\LaravelSanitized\Sanitized;

class YoutModel extends Model
{
    use Sanitized;
    ...
```

And also add the list of model's fields you want to be sanitized:

```
  protected array $fieldsToSanitize = [
    'body',
    'description',
    ...
  ];
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

### Security

[](#security)

If you discover any security related issues, please email opiy\[at\]opiy.org instead of using the issue tracker.

Credits
-------

[](#credits)

- [opiy](https://github.com/opiy-org)

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~0 days

Total

6

Last Release

1701d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c5c5cd9409f21416fb4825f947b7f2f31f0f4643b9bcd44e67c2412a5ee5042e?d=identicon)[opiy-org](/maintainers/opiy-org)

---

Top Contributors

[![alexv14vvv](https://avatars.githubusercontent.com/u/61771945?v=4)](https://github.com/alexv14vvv "alexv14vvv (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![opiy-org](https://avatars.githubusercontent.com/u/10293975?v=4)](https://github.com/opiy-org "opiy-org (3 commits)")

---

Tags

laravelhtmlmodelpurifyelquent

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/opiy-org-laravel-sanitized/health.svg)

```
[![Health](https://phpackages.com/badges/opiy-org-laravel-sanitized/health.svg)](https://phpackages.com/packages/opiy-org-laravel-sanitized)
```

###  Alternatives

[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5396.5M34](/packages/stevebauman-purify)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k12.5k1](/packages/vinkius-labs-laravel-page-speed)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[lemaur/eloquent-publishing

218.1k1](/packages/lemaur-eloquent-publishing)

PHPackages © 2026

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