tomcan/content-security-policy

Content-Security-Policy parser and generator library

v3.2.0 2020-07-06 20:27 UTC

This package is auto-updated.

Last update: 2024-11-07 05:57:18 UTC


README

A PHP Content-Security-Policy library

Usage

Install through composer

# composer require tomcan/content-security-policy

<?php
require __DIR__ . '/vendor/autoload.php';
$csp = new \TomCan\Csp\ContentSecurityPolicy();
$csp->addToDirective(\TomCan\Csp\ContentSecurityPolicy::DIRECTIVE_DEFAULT_SRC, 'self');
echo $csp; // default-src: 'self';