PHP Classes

File: bin/compile_apache.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   PHP CSP Header Builder   bin/compile_apache.php   Download  
File: bin/compile_apache.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: 295 bytes
 

Contents

Class file image Download
<?php
use \ParagonIE\CSPBuilder\CSPBuilder;

require_once \
dirname(__DIR__).'/vendor/autoload.php';

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

$policy = CSPBuilder::fromFile($argv[1]);
$policy->saveSnippet($argv[2], CSPBuilder::FORMAT_APACHE);
exit(
0);