简体   繁体   English

HTML Purifier Symfony2.3

[英]HTML Purifier Symfony2.3

I'd like to add HTML Purifier to my Symfony application, I'm using Symfony2.3. 我想将HTML Purifier添加到我的Symfony应用程序中,我正在使用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. 第一个是将HTML Purifier库直接添加到symfony中,但是我不知道该怎么做,我试图找到教程,但我不理解。

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. 第二种方法是使用此捆绑包: https : //github.com/Exercise/HTMLPurifierBundle但是我不知道如何用作曲家安装它,而且我认为该文档不适用于Symfony 2.0。

So do you have a solution to easily install HTML Purifier, I don't need twig module given with the bundle. 那么,您是否有一种可以轻松安装HTML Purifier的解决方案,所以我不需要捆绑包随附的twig模块。

Thanks for your help 谢谢你的帮助

The bundle has a composer.json file, so you can simply add it to your requirements: 该捆绑包包含一个composer.json文件,因此您可以将其添加到您的需求中:

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

If you don't need the bundle. 如果您不需要捆绑包。 you can just add the HTMLPurifier package: 您可以只添加HTMLPurifier包:

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

If you see a composer.json file in a repository on Github, you can just search on Packagist: 如果您在Github上的存储库中看到composer.json文件,则可以在Packagist上搜索:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM