PHP code example of mattmontgomery / sri-integrity-hashes

1. Go to this page and download the library: Download mattmontgomery/sri-integrity-hashes 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/ */

    

mattmontgomery / sri-integrity-hashes example snippets


use DDM\SRIIntegrityHash\Loaders;

$loaders = new Loaders();

$file = $loaders->getFile('example/assets.json', 'common.js');

echo sprintf("Loaded %s from %s\n", $file->filename, $file->namespace);
echo sprintf("Script tag: %s\n", $file->toScript());