@hala Check https://github.com/stevebauman/purify/issues/14
Or use this package https://github.com/mewebstudio/Purifier
Where you can definecustom_attributes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i have purifier config having this
'HTML.Allowed' => 'a[href|rel|target]',
when i make
Purify::clean($body);
the body return without target='_blank'
I was able to achieve this by using the following
$config = [
'HTML.Allowed' => 'a[href|target]',
'Attr.AllowedFrameTargets' => ['_blank']
];
Purify::clean($value, $config);
This then returned
<a href="..." target="_blank">...</a>
Please or to participate in this conversation.