PHPackages                             ezyang/htmlpurifier - 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. ezyang/htmlpurifier

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

ezyang/htmlpurifier
===================

Standards compliant HTML filter written in PHP

v4.19.0(10mo ago)3.4k360.8M↓11.5%358[108 issues](https://github.com/ezyang/htmlpurifier/issues)[27 PRs](https://github.com/ezyang/htmlpurifier/pulls)20LGPL-2.1-or-laterPHPPHP ~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI failing

Since Feb 18Pushed 10mo ago57 watchersCompare

[ Source](https://github.com/ezyang/htmlpurifier)[ Packagist](https://packagist.org/packages/ezyang/htmlpurifier)[ Docs](http://htmlpurifier.org/)[ RSS](/packages/ezyang-htmlpurifier/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (4)Dependencies (2)Versions (24)Used By (20)Security (4)

HTML Purifier [![Build Status](https://github.com/ezyang/htmlpurifier/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/ezyang/htmlpurifier/actions/workflows/ci.yml)
=========================================================================================================================================================================================

[](#html-purifier-)

HTML Purifier is an HTML filtering solution that uses a unique combination of robust whitelists and aggressive parsing to ensure that not only are XSS attacks thwarted, but the resulting HTML is standards compliant.

HTML Purifier is oriented towards richly formatted documents from untrusted sources that require CSS and a full tag-set. This library can be configured to accept a more restrictive set of tags, but it won't be as efficient as more bare-bones parsers. It will, however, do the job right, which may be more important.

Places to go:

- See INSTALL for a quick installation guide
- See docs/ for developer-oriented documentation, code examples and an in-depth installation guide.
- See WYSIWYG for information on editors like TinyMCE and FCKeditor

HTML Purifier can be found on the web at:

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

[](#installation)

Package available on [Composer](https://packagist.org/packages/ezyang/htmlpurifier).

If you're using Composer to manage dependencies, you can use

```
$ composer require ezyang/htmlpurifier

```

###  Health Score

75

—

ExcellentBetter than 100% of packages

Maintenance54

Moderate activity, may be stable

Popularity85

Widely adopted with strong download metrics

Community60

Healthy contributor diversity

Maturity90

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 76.8% 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 ~289 days

Recently: every ~281 days

Total

17

Last Release

304d ago

PHP version history (5 changes)v4.5.0PHP &gt;=5.2

v4.15.0PHP ~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0

v4.17.0PHP ~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0

v4.18.0PHP ~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0

v4.19.0PHP ~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/00227460e374a3425259e09388877a783e5e79a00fc6958b193f336d6ef4015d?d=identicon)[robo47](/maintainers/robo47)

![](https://www.gravatar.com/avatar/6aaa9d10a82c2cf3d676f1f9397c2ae05ee2534182eda446128c0fe7c04494ba?d=identicon)[ezyang](/maintainers/ezyang)

---

Top Contributors

[![ezyang](https://avatars.githubusercontent.com/u/13564?v=4)](https://github.com/ezyang "ezyang (268 commits)")[![bytestream](https://avatars.githubusercontent.com/u/1788397?v=4)](https://github.com/bytestream "bytestream (17 commits)")[![TimWolla](https://avatars.githubusercontent.com/u/209270?v=4)](https://github.com/TimWolla "TimWolla (8 commits)")[![xemlock](https://avatars.githubusercontent.com/u/952555?v=4)](https://github.com/xemlock "xemlock (6 commits)")[![PHPGangsta](https://avatars.githubusercontent.com/u/608408?v=4)](https://github.com/PHPGangsta "PHPGangsta (5 commits)")[![zerocrates](https://avatars.githubusercontent.com/u/298975?v=4)](https://github.com/zerocrates "zerocrates (5 commits)")[![Synchro](https://avatars.githubusercontent.com/u/81561?v=4)](https://github.com/Synchro "Synchro (4 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (4 commits)")[![Xiphin](https://avatars.githubusercontent.com/u/3348428?v=4)](https://github.com/Xiphin "Xiphin (3 commits)")[![mpyw](https://avatars.githubusercontent.com/u/1351893?v=4)](https://github.com/mpyw "mpyw (2 commits)")[![kish0808](https://avatars.githubusercontent.com/u/44048735?v=4)](https://github.com/kish0808 "kish0808 (2 commits)")[![kitrio](https://avatars.githubusercontent.com/u/7542987?v=4)](https://github.com/kitrio "kitrio (2 commits)")[![snapshotpl](https://avatars.githubusercontent.com/u/312655?v=4)](https://github.com/snapshotpl "snapshotpl (2 commits)")[![totten](https://avatars.githubusercontent.com/u/1336047?v=4)](https://github.com/totten "totten (2 commits)")[![pieterocp](https://avatars.githubusercontent.com/u/68863060?v=4)](https://github.com/pieterocp "pieterocp (2 commits)")[![matsuo](https://avatars.githubusercontent.com/u/141021?v=4)](https://github.com/matsuo "matsuo (2 commits)")[![elirenato](https://avatars.githubusercontent.com/u/9608366?v=4)](https://github.com/elirenato "elirenato (2 commits)")[![zobzn](https://avatars.githubusercontent.com/u/579620?v=4)](https://github.com/zobzn "zobzn (1 commits)")[![dadkhah-dev](https://avatars.githubusercontent.com/u/6449139?v=4)](https://github.com/dadkhah-dev "dadkhah-dev (1 commits)")[![morozov](https://avatars.githubusercontent.com/u/59683?v=4)](https://github.com/morozov "morozov (1 commits)")

---

Tags

html

### Embed Badge

![Health badge](/badges/ezyang-htmlpurifier/health.svg)

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

###  Alternatives

[symfony/html-sanitizer

Provides an object-oriented API to sanitize untrusted HTML input for safe insertion into a document's DOM.

28145.6M200](/packages/symfony-html-sanitizer)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5386.8M38](/packages/stevebauman-purify)[xemlock/htmlpurifier-html5

HTML5 support for HTML Purifier

1063.3M20](/packages/xemlock-htmlpurifier-html5)[form-manager/form-manager

PHP-HTML form manager

15943.2k7](/packages/form-manager-form-manager)[aura/input

This package contains tools to describe and filter user inputs from an HTML form, including sub-forms/sub-fieldsets, fieldset collections, an interface for injecting custom filter systems, and CSRF protection. Note that this package does not include output functionality, although the "hints" provided by the Form object can be used with any presentation system to generate an HTML form.

6481.9k5](/packages/aura-input)[qevix/qevix

Automatic filter HTML/XHTML

1610.5k](/packages/qevix-qevix)

PHPackages © 2026

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