PHP code example of hyva-themes / magento2-optimized-csp-allowlist

1. Go to this page and download the library: Download hyva-themes/magento2-optimized-csp-allowlist 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/ */

    

hyva-themes / magento2-optimized-csp-allowlist example snippets



// .. snap
$cspViewModel = $block->getCspViewModel();
$cspViewModel->add('script-src', 'https://lang.host.ext')
// .. /snap


// .. snap
$cspViewModel = $viewModels->g.host.ext')
// .. /snap