PHPackages                             webchemistry/html-purifier - 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. webchemistry/html-purifier

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

webchemistry/html-purifier
==========================

Html purifier

v0.9(7y ago)05PHPPHP &gt;= 7.2

Since Mar 13Pushed 7y ago1 watchersCompare

[ Source](https://github.com/WebChemistry/html-purifier)[ Packagist](https://packagist.org/packages/webchemistry/html-purifier)[ RSS](/packages/webchemistry-html-purifier/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Simple html purifier
--------------------

[](#simple-html-purifier)

Usage:

```
$rules = new Rules();

$rules->addMulti(
	ElementRule::create('i'),
	ElementRule::create('div'),
	ElementRule::create('strong')
		->addAttributeRule(
			AttributeRule::create('class')
				->allowValue('italic')
		),
	ElementRule::create('script')
		->discard(),
	ElementRule::create('span')
		->addAttributeRule(
			AttributeStyleRule::create()
				->addRule('color', ['white', '#fff', '#fffff'])
		)
);

$purifier = new Purifier($rules);

$purifier->purify('

		Lorem ipsum is simply

		alert("dummy text!")

		white and red

');
```

output:

```

	Lorem ipsum is simply

	white and red

```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2666d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/312e788a47a251e05734378921d4596a91819b7de416fa18e77aa69e08798ea8?d=identicon)[Antik](/maintainers/Antik)

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/webchemistry-html-purifier/health.svg)

```
[![Health](https://phpackages.com/badges/webchemistry-html-purifier/health.svg)](https://phpackages.com/packages/webchemistry-html-purifier)
```

###  Alternatives

[chaoswey/taiwan-id-validator

台灣身分證、統一編號驗證

319.9k](/packages/chaoswey-taiwan-id-validator)

PHPackages © 2026

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