Search code examples
phpsymfonyhtmlpurifier

HTML Purifier Symfony2.3


I'd like to add HTML Purifier to my Symfony application, I'm using Symfony2.3. I found two ways but I have problems on both.

The first one is to directly add the HTML Purifier library into symfony but I don't know realy how to do that, I tried to find tutorials but I don't understand.

The second way is to use this bundle: https://github.com/Exercise/HTMLPurifierBundle But I don't know how to install it with composer, and I think the documentation is for Symfony 2.0 no higher.

So do you have a solution to easily install HTML Purifier, I don't need twig module given with the bundle.

Thanks for your help


Solution

  • The bundle has a composer.json file, so you can simply add it to your requirements:

    require: "exercise/htmlpurifier-bundle": "1.0.*@dev"
    

    If you don't need the bundle. you can just add the HTMLPurifier package:

    require: "ezyang/htmlpurifier": "dev-master"
    

    If you see a composer.json file in a repository on Github, you can just search on Packagist: