PHP Classes

File: bin/compile_csp.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   PHP CSP Header Builder   bin/compile_csp.php   Download  
File: bin/compile_csp.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP CSP Header Builder
Generate Content Security Policy headers
Author: By
Last change:
Date: 5 years ago
Size: 254 bytes
 

Contents

Class file image Download
<?php
require_once \dirname(__DIR__).'/vendor/autoload.php';

if (
$argc < 2) {
    die(
"Usage: php compile_csp.php [json source file]");
}

$policy = \ParagonIE\CSPBuilder\CSPBuilder::fromFile($argv[1]);
echo
$policy->getCompiledHeader(), "\n";
exit(
0);