You need something like html purifer. I think there is a version for laravel.
Like https://github.com/mewebstudio/Purifier
But look at others as well.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am using TinyMCE Editor to write some articles But I am using posted data without any protection.
when I store article data
$content = $_POST['content'];
I do not use
filter_input(INPUT_POST, 'content')
Because it converts html to string
...
When I display data I use
$content = $_POST['content'];
``
echo $content;
``
without any serialization..
I wanna secure data and in the same way want html to display as it is.
@ebrahemsamer for native PHP this is the best option 👉http://htmlpurifier.org/docs
Please or to participate in this conversation.