Package Data | |
---|---|
Maintainer Username: | timgws |
Maintainer Contact: | tim@timg.ws (Tim Groeneveld) |
Package Create Date: | 2013-06-13 |
Package Last Update: | 2016-03-11 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-15 15:15:52 |
Package Statistics | |
---|---|
Total Downloads: | 115 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 6 |
Total Watchers: | 3 |
Total Forks: | 2 |
Total Open Issues: | 0 |
Making HTML clean since late 2012!
composer require timgws/cleanhtml
use timgws\CleanHTML\CleanHTML;
$tidy = new CleanHTML();
$output = $tidy->clean('<p><strong>I need a shower. I am dirty HTML.</strong>');
$output should now contain:
<h2>I need a shower. I am dirty HTML.</h2>
Using the Clean function will remove tables, any Javascript or other non-friendly items that you might not want to see from user submitted HTML.
If you want to see some examples, the best place to look would be some of the CleanHTML test
<br />
tags with paragraph tags<script>
tags<h1>
tags to <h2>
<p><strong>
tags to <h2>
<h2><strong>
with just <h2>
tags<p><span>
tags