ezyang/htmlpurifier
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The ezyang/htmlpurifier is a comprehensive filtering solution that assures standards-compliant HTML code. By leveraging an optimal blend of stringent whitelists and aggressive parsing, the purifier effectively counteracts Cross-Site Scripting (XSS) attacks while guaranteeing standards-compliant resultant HTML. Created primarily for richly-designed documents from dubious sources that need CSS and an extensive tag set, it offers customizable configurations for accepting a narrower tag set, while adhering steadfastly to delivering flawless results.
Utilizing the ezyang/htmlpurifier is straightforward thanks to its compatibility with Composer, a tool for dependency management in PHP. You need to install Composer, then simply run the command $ composer require ezyang/htmlpurifier
in your terminal. This action automatically installs the HTML Purifier package into your project, thus enabling you to use it as per your requirements. For example, you may use it in your PHP code like so:
require_once '/path/to/htmlpurifier/library/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$clean_html = $purifier->purify($dirty_html);
In this case, $dirty_html
is the unfiltered user-submitted content that you want to clean.
The ezyang/htmlpurifier documentation is primarily located in the docs/
directory of the project repository on GitHub. It offers developer-oriented documentation, code examples, and a detailed installation guide. For contributors and users who prefer web-based accessibility, an online version of the documentation and additional resources are maintained on the package's official website. For specifics regarding the implementation of the purifier with WYSIWYG editors like TinyMCE and FCKeditor, refer to the WYSIWYG documentation in the repository.