PHP Classes

File: bin/compile_nginx.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   PHP CSP Header Builder   bin/compile_nginx.php   Download  
File: bin/compile_nginx.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: 294 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_NGINX);
exit(
0);