PHP code example of pavlakis / csp-middleware

1. Go to this page and download the library: Download pavlakis/csp-middleware library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pavlakis / csp-middleware example snippets



$app->add(new \Pavlakis\Middleware\Csp\CspMiddleware($container->get('csp'));



$container['csp'] = function ($c) {
    $csp = CSPBuilder::fromFile(__DIR__ . '/configs/csp.json');
    return $csp;
};



$app->add(new \Pavlakis\Middleware\Csp\CspMiddleware($container->get('csp'));