# How to config plugin HTML purifier

**URL:** https://discourse.cakephp.org/t/how-to-config-plugin-html-purifier/8653
**Category:** Plugins
**Created:** [November 24, 2020, 8:43am UTC](https://discourse.cakephp.org/t/how-to-config-plugin-html-purifier/8653 "2020-11-24T08:43:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![arizzoye](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@arizzoye](https://discourse.cakephp.org/u/arizzoye)
#### Post date: [November 24, 2020, 8:43am UTC](https://discourse.cakephp.org/t/how-to-config-plugin-html-purifier/8653/1 "2020-11-24T08:43:06Z")

</div>

I have trouble while config HTML purifier that was installed from github used `composer` below  
`$ composer require ezyang/htmlpurifier`

next I called them from `bootstrap.php`

```auto
$this->addPlugin('ezyang/htmlpurifier');

```

and called them from `src/Application.php`

```auto
public function bootstrap()
   {
     parent::bootstrap();
     $this->addPlugin('ezyang/htmlpurifier');
   }

```

next I was try to config `in method` below this

```auto
use Cake\Event\Event;
use ArrayObject;

public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options)
	{
	  foreach ($data as $key => $article) {
		 if(is_string($article)) {
		  $config = HTMLPurifier_Config::createDefault();
		  $purifier = new HTMLPurifier($config);
		  $clean_html = $purifier->purify($article);
		  $data[$key] = $clean_html;
		 }
	  }
	}

```

but the shown error display below

```auto
Error: The application is trying to load a file from the ezyang/htmlpurifier plugin.

Make sure your plugin ezyang/htmlpurifier is in the C:\xampp\htdocs\klinikucing\plugins\ directory and was loaded. 

<?php
// src/Application.php
public function bootstrap()
{
    parent::bootstrap();

    $this->addPlugin('ezyang/htmlpurifier');
}

```

How the way to make this plugin works, I hope someone help me, thanx

---

<div class="post-metadata">

### Author: ![Salines](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/salines/32/3166_2.png) [@Salines](https://discourse.cakephp.org/u/Salines)
#### Post date: [November 24, 2020, 11:44am UTC](https://discourse.cakephp.org/t/how-to-config-plugin-html-purifier/8653/2 "2020-11-24T11:44:29Z")

</div>

ezyang/htmlpurifier is not cakephp plugin.

You must [autoload ezyang/htmlpurifier](https://phpenthusiast.com/blog/how-to-autoload-with-composer) and or read this doc

> **[Documentation - HTML Purifier](http://htmlpurifier.org/docs/)**
