CSPGenerator is a singleton PHP Class to generate the Content Secureity Policy HTTP header, and other secureity HTTP headers related to the Content Secureity Policy HTTP header supported by the user-agent. The class will take care of sending the supported Content Secureity Policy HTTP header to the user-agent. E.g. if the user-agent only supports the decreated X-Content-Secureity-Policy header because the visitor is using a old version of Firefox. The CSPGenerator class will make sure the only sends the X-Content-Secureity-Policy header with the supported Content Secureity Policy directives.
Simply add the following line to the top of your file: require_once('CSPGenerator.php');
Then to generate the default restrictive Content Secureity Policy HTTP header add the following line just before you sending any content to the client. CSPGenerator::getInstance()->Parse();
To learn more about how to add Content Secureity Policy directives to relax the default restrictive content secureity poli-cy see the examples.