PHPackages                             bnomei/kirby3-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. [Search &amp; Filtering](/categories/search)
4. /
5. bnomei/kirby3-htmlpurifier

AbandonedArchivedKirby-plugin[Search &amp; Filtering](/categories/search)

bnomei/kirby3-htmlpurifier
==========================

Static class method, Uniform-Guard and Field-Method to filter your "dirty" HTML inputs to "clean" HTML.

1.0.3(3y ago)3463MITPHPPHP &gt;=7.3.0

Since Mar 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/bnomei/kirby3-htmlpurifier)[ Packagist](https://packagist.org/packages/bnomei/kirby3-htmlpurifier)[ RSS](/packages/bnomei-kirby3-htmlpurifier/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

Kirby HtmlPurifier
==================

[](#kirby-htmlpurifier)

[![Release](https://camo.githubusercontent.com/501f79858aa30da2b39268ebc22e2c117d4ebf83e08075df4df336531fdf9834/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d68746d6c70757269666965723f636f6c6f723d616538316666)](https://camo.githubusercontent.com/501f79858aa30da2b39268ebc22e2c117d4ebf83e08075df4df336531fdf9834/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b69726279332d68746d6c70757269666965723f636f6c6f723d616538316666)[![Downloads](https://camo.githubusercontent.com/401da20ceee7ac3ecf4db273c67ad0c4b4ce4e2ddd63e27471ce7461a5a64d7e/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f626e6f6d65692f6b69726279332d68746d6c70757269666965723f636f6c6f723d323732383232)](https://camo.githubusercontent.com/401da20ceee7ac3ecf4db273c67ad0c4b4ce4e2ddd63e27471ce7461a5a64d7e/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f626e6f6d65692f6b69726279332d68746d6c70757269666965723f636f6c6f723d323732383232)[![Build Status](https://camo.githubusercontent.com/4c9042df90f9078ed268eb1c9afd3de8a9f544b2cba2bdd46b468846977995b2/68747470733a2f2f666c61742e62616467656e2e6e65742f7472617669732f626e6f6d65692f6b69726279332d68746d6c7075726966696572)](https://travis-ci.com/bnomei/kirby3-htmlpurifier)[![Coverage Status](https://camo.githubusercontent.com/961bd2ea30c422eb3c355bcd422b62c598fc984058a0689fccaa077a20cefb8c/68747470733a2f2f666c61742e62616467656e2e6e65742f636f766572616c6c732f632f6769746875622f626e6f6d65692f6b69726279332d68746d6c7075726966696572)](https://coveralls.io/github/bnomei/kirby3-htmlpurifier)[![Maintainability](https://camo.githubusercontent.com/7e54572743908adbed7f27b6ed82f120a95772a1962301afc70fbb801775ac32/68747470733a2f2f666c61742e62616467656e2e6e65742f636f6465636c696d6174652f6d61696e7461696e6162696c6974792f626e6f6d65692f6b69726279332d68746d6c7075726966696572)](https://codeclimate.com/github/bnomei/kirby3-htmlpurifier)[![Twitter](https://camo.githubusercontent.com/b90e4b58a887e8ad09ec267628b75199a48522a9e01e88b129e5d2d730dffe50/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f747769747465722f626e6f6d65693f636f6c6f723d363664396566)](https://twitter.com/bnomei)

Static class method, Uniform-Guard and Field-Method to filter your "dirty" HTML inputs to "clean" HTML.

[strip\_tags](https://www.php.net/manual/en/function.strip-tags.php) and [PHP Input Filter](https://www.phpclasses.org/package/2189-PHP-Filter-out-unwanted-PHP-Javascript-HTML-tags-.html) are not good enough for you? Installing a plugin that has a dependency with lots of code does not bother you? You are willing to take the performance hit if you use it? Read on then...

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

[](#installation)

- unzip [master.zip](https://github.com/bnomei/kirby3-htmlpurifier/archive/master.zip) as folder `site/plugins/kirby3-htmlpurifier` or
- `git submodule add https://github.com/bnomei/kirby3-htmlpurifier.git site/plugins/kirby3-htmlpurifier` or
- `composer require bnomei/kirby3-htmlpurifier`

Usage PHP
---------

[](#usage-php)

```
$cleanHtml = \Bnomei\HtmlPurifier::purify($dirtyHtml);
```

Usage Uniform-Guard
-------------------

[](#usage-uniform-guard)

Because of the plugin loading order the `htmlPurifyGuard` will only be available with composer installations of this plugin.

```
$form = new \Uniform\Form;

if (kirby()->request()->is('POST')) {

    $form->honeypotGuard() // needs to be called explicitly now
        ->htmlPurifyGuard(); // purified all data

    if ($form->success()) {
        // ...
    }
}
```

Usage Field-Method
------------------

[](#usage-field-method)

```
$dirtHtml = (string) $page->myfield();
$cleanHtml = (string) $page->myfield()->htmlPurify();
$cleanHtml = (string) $page->myfield()->kirbytext()->htmlPurify();
```

Usage with KQL for headless
---------------------------

[](#usage-with-kql-for-headless)

If you want to make extra sure your html output to headless is valid html you can purify your fields. Be advised that this will come with a performance penalty since purification is no simple task.

> ⚠️ All proprietary elements (``, ...) and attributes (`srcset`, `sizes`, `data-*`, `x-*:`, `@*:`, ...) will be removed!

**KQL Query**

```
{
    "query": "page('photography')",
    "select": {
        "url": true,
        "title": true,
        "textWithPurifiedHtml": "page.text.kirbytext.htmlPurify"
    }
}
```

**Example: Vue**

```

```

Settings
--------

[](#settings)

bnomei.htmlpurifier.DefaultDescriptionconfigcallbackoverwrite this to adjust the config of used HtmlPurifier dependencyDependecies
-----------

[](#dependecies)

- [Kirby 3 Plugin Uniform](https://github.com/mzur/kirby-uniform)
- [HtmlPurifier](https://github.com/ezyang/htmlpurifier)

Disclaimer
----------

[](#disclaimer)

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please [create a new issue](https://github.com/bnomei/kirby3-htmlpurifier/issues/new).

License
-------

[](#license)

[MIT](https://opensource.org/licenses/MIT)

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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 ~378 days

Total

4

Last Release

1118d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.2.0

1.0.1PHP &gt;=7.3.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3265642?v=4)[Bruno Meilick](/maintainers/bnomei)[@bnomei](https://github.com/bnomei)

---

Top Contributors

[![bnomei](https://avatars.githubusercontent.com/u/3265642?v=4)](https://github.com/bnomei "bnomei (12 commits)")

---

Tags

filterformheadlesshtmlhtmlawedinputkirby3kirby3-cmskirby3-pluginkqlksessafesanitizesecuritystriptagssubmituniformxsssecuritysafehtmlfiltercleanheadlessuniformxssforminputsanitizekseskirby3submitkirby3-pluginkirby3-cmskqlstriptagshtmlawed

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[htmlawed/htmlawed

Official htmLawed PHP library for HTML filtering

401.1M9](/packages/htmlawed-htmlawed)[soosyze/kses

An HTML/XHTML filter written in PHP. Checks on attribute values. Can be used to avoid Cross-Site Scripting (XSS), Buffer Overflows and Denial of Service attacks, among other things.

1258.5k1](/packages/soosyze-kses)[lincanbin/white-html-filter

A lightweight php-based HTML tag and attribute whitelist filter.

1215.1k1](/packages/lincanbin-white-html-filter)[bvdputte/kirby-bettersearch

A search plugin for Kirby (v3+ that searches for full word combinations rather than just individual words.

233.5k](/packages/bvdputte-kirby-bettersearch)

PHPackages © 2026

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