PHPackages                             ardabeyazoglu/htmlpurifierx - 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. ardabeyazoglu/htmlpurifierx

ActiveLibrary

ardabeyazoglu/htmlpurifierx
===========================

A shim around original HTMLPurifier library to allow more customizations

1.0.4(5mo ago)07LGPL-2.1-or-laterPHPPHP &gt;=8.1

Since Jul 11Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/ardabeyazoglu/htmlpurifierx)[ Packagist](https://packagist.org/packages/ardabeyazoglu/htmlpurifierx)[ Docs](https://github.com/ardabeyazoglu/htmlpurifierx)[ RSS](/packages/ardabeyazoglu-htmlpurifierx/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (5)Used By (0)

HTMLPurifierX
=============

[](#htmlpurifierx)

HTMLPurifierX is a small wrapper around original [ezyang/htmlpurifier](https://github.com/ezyang/htmlpurifier) library, providing a few more customization options. It is also compatible with [xemlock/htmlpurifier-html5](https://github.com/xemlock/htmlpurifier-html5).

It extends configuration options to allow following features that can't be accomplished otherwise, because htmlpurifier follows a design principle based on whitelisting single elements and attributes.

- Allow all data-\* attributes on elements, since they are harmless and used very often.

    ```
      $configObject->set("HTML.AllowDataAttributes", true);

    ```
- Allow namespaced attributes like "xxx:yyyyyy" on elements, since they are used in modern frameworks.

    ```
      $configObject->set("HTML.AllowNamespacedAttributes", true);

    ```
- Allow all custom element names that satisy a regex, since they are widely used in web components and modern frameworks. A common use case would be to allow all elements with a user defined prefix.

    ```
      $configObject->set("HTML.AllowCustomElements", true);
      // default "": means allow all custom elements.
      $configObject->set("HTML.AllowCustomElementsRegex", "/^x-/");

    ```

Check [examples](examples/) to see how it works.

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

[](#installation)

```
composer require ardabeyazoglu/htmlpurifierx

```

This will also install original ezyang/htmlpurifier library if not already installed.

Why not fork ?
--------------

[](#why-not-fork-)

The customizations made here might be against the design principles of original library. It is easier and faster to provide them as an extra layer.

License
-------

[](#license)

LGPL (same as the original library)

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance70

Regular maintenance activity

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~530 days

Total

4

Last Release

173d ago

PHP version history (2 changes)1.0.1PHP &gt;=5.2

1.0.4PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/f5c6c17d31b1cf3eb1a741ebfbcf2ff4103b9bacc89f3397c14c64cf2af65b81?d=identicon)[ardabeyazoglu](/maintainers/ardabeyazoglu)

---

Top Contributors

[![ardabeyazoglu](https://avatars.githubusercontent.com/u/1159836?v=4)](https://github.com/ardabeyazoglu "ardabeyazoglu (6 commits)")

### Embed Badge

![Health badge](/badges/ardabeyazoglu-htmlpurifierx/health.svg)

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

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[magento/community-edition

Magento 2 (Open Source)

12.1k52.1k10](/packages/magento-community-edition)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[jason-munro/cypht

Lightweight Open Source webmail written in PHP and JavaScript

1.5k146.0k](/packages/jason-munro-cypht)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)

PHPackages © 2026

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