0

I have been trying to set up free-pik-labs/dompurify on a php project and it just does not work. Can anyone help me?

I installed it with composer to my project's local directory and ran the code below:

require_once '../vendor/autoload.php';
use FreepikLabs\DomPurify\Purifier;

$process = new Purifier;

// Output will look like <svg><g></g></svg>
$sanitized = $process->clean('<svg><g onload="alert(\'test\')"></g>', [
    'USE_PROFILES' => [
        'svg' => true
    ]
]);

and I get this error

Karl Hill
  • 12,937
  • 5
  • 58
  • 95

0 Answers0