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(7mo ago)3.3k327.6M—2.2%354[108 issues](https://github.com/ezyang/htmlpurifier/issues)[25 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 7mo ago59 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 1mo 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

77

—

ExcellentBetter than 100% of packages

Maintenance64

Regular maintenance activity

Popularity85

Widely adopted with strong download metrics

Community58

Growing community involvement

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

213d 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.

27932.2M63](/packages/symfony-html-sanitizer)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[xemlock/htmlpurifier-html5

HTML5 support for HTML Purifier

1052.9M11](/packages/xemlock-htmlpurifier-html5)[form-manager/form-manager

PHP-HTML form manager

16041.0k7](/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.

6678.4k4](/packages/aura-input)[kdyby/html-validator-panel

Nette DebugBar panel for validating the output HTML.

1034.6k3](/packages/kdyby-html-validator-panel)

PHPackages © 2026

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