# HtmlPurifier

> HtmlPurifier provides an ability to clean up HTML from any harmful code.

[API reference](/docs/api/index.md) › [yii](/docs/api/yii/index.md) › [helpers](/docs/api/yii/helpers/index.md) › HtmlPurifier

| class | `yii\helpers\HtmlPurifier` |
| --- | --- |
| Extends | [`BaseHtmlPurifier`](/docs/api/yii/helpers/basehtmlpurifier/index.md) |
| Since | 2.0 |
| Source | [`framework/helpers/HtmlPurifier.php`](https://github.com/yiisoft/yii2/blob/22.0/framework/helpers/HtmlPurifier.php#L33) |

HtmlPurifier provides an ability to clean up HTML from any harmful code.

Basic usage is the following:

```
echo HtmlPurifier::process($html);
```

If you want to configure it:

```
echo HtmlPurifier::process($html, [
    'Attr.EnableID' => true,
]);
```

For more details please refer to [HTMLPurifier documentation](http://htmlpurifier.org/).

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| <span id="method-process"></span>[`process()`](/docs/api/yii/helpers/basehtmlpurifier/index.md#method-process) static | Passes markup through HTMLPurifier making it safe to output to end user. | [`BaseHtmlPurifier`](/docs/api/yii/helpers/basehtmlpurifier/index.md) |
| <span id="method-configure"></span>[`configure()`](/docs/api/yii/helpers/basehtmlpurifier/index.md#method-configure) protected static | Allow the extended HtmlPurifier class to set some default config options. | [`BaseHtmlPurifier`](/docs/api/yii/helpers/basehtmlpurifier/index.md) |