Server-side HTML cleaning
The HTML below contains a script, an onerror handler and a javascript: link. Submit it: the server keeps the content and removes the active parts. Anyone can post to your page without the editor, so this runs on the server.
The PHP for this demo
$clean = $editor->posted(); // or, for HTML from anywhere: $clean = (new PhpHtmlEditor\Sanitizer($editor->policy()))->sanitize($html);
Removed: <script>, on* attributes, javascript: and data: URLs (except raster images), forms, SVG, <object> and <embed>; iframes keep a sandbox without same-origin access. The policy's TagBlackList, AttrBlackList and StyleBlackList remove more.