You need a KSES/HTML Filter package which will let you filter out any HTML tags/attributes that are not on your allow list. That way you can define which tags you want to allow & what attributes you want to allow on those tags. You can try this package though it hasn't been updated in a while.
Jun 16, 2024
3
Level 1
How to Handl HTML from Client-Side WYSIWYG Editor
I’m fairly new to PHP and Laravel, and I’ve been trying to figure out how to properly handle HTML content from a WYSIWYG editor, before storing in the string in db. I’ve experimented with a couple of packages:
https://github.com/mewebstudio/Purifier https://github.com/stevebauman/purify
Most of the tutorials i find here and other sources use markdown editor, but unfortunately I can't use a markdown editor as the client requirement is to use a WYSIWYG Editor like ckeditor or tinymce.
Could you anyone point me to a resource that help me with handle html and css sanitisation and remove all & any kind of js (including inline js)
Thank you in advance.
Please or to participate in this conversation.