PHP code example of tomcan / content-security-policy

1. Go to this page and download the library: Download tomcan/content-security-policy 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/ */

    

tomcan / content-security-policy example snippets



= new \TomCan\Csp\ContentSecurityPolicy();
$csp->addToDirective(\TomCan\Csp\ContentSecurityPolicy::DIRECTIVE_DEFAULT_SRC, 'self');
echo $csp; // default-src: 'self';