PHP code example of offline / oc-csp-plugin

1. Go to this page and download the library: Download offline/oc-csp-plugin 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/ */

    

offline / oc-csp-plugin example snippets


// Add this to your Plugin.php's boot method.
\Event::listen('offline.csp.extend', function (&$settings, $controller) {
     // Check for a certain page. You could also use ->fileName here.
    if (starts_with($controller->getPage()->url, '/needs-unsafe-eval')) {
        // Add the unsafe-eval option to the script_src configuration.
        $settings['script_src'][] = 'unsafe-eval';
    }
});


php artisan csp:disable