PHP code example of freepik-labs / dom-purify

1. Go to this page and download the library: Download freepik-labs/dom-purify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

freepik-labs / dom-purify example snippets



    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
        ]
    ]);