PHP code example of m1 / twig-asset-rev-extension

1. Go to this page and download the library: Download m1/twig-asset-rev-extension 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/ */

    

m1 / twig-asset-rev-extension example snippets


new TwigAssetRevExtension(mixed $assets [, bool $minified = true ] )

array(
  "css/app.css" => "css/app.bd6efcb01bc3.css",
  "css/app.min.css" => "css/app.min.9f8d3d255c1f.css",
  "js/app.admin.js" => "js/app.admin.96b3cc15df52.js",
  "js/app.admin.min.js" => "js/app.admin.min.dbdc6d8e2114.js",
  "js/app.admin.plugins.js" => "js/app.admin.plugins.927a9b50dd18.js",
  "js/app.admin.plugins.min.js" => "js/app.admin.plugins.min.283a1a903f4a.js",
  "img/image-jpg.jpg" => "img/image-jpg.219a48cfe072.jpg",
  "img/image-png.png" => "img/image-png.1691620d298a.png",
  "img/image-gif.gif" => "img/image-gif.bcd9f17c5cf8.png"
)
 php
Use \M1\TwigAssetRevExtension\TwigAssetRevExtension;

$assets = json_decode(file_get_contents('rev-manifest.json'), true);
$asset_rev = new TwigAssetRevExtension($assets);
$twig->addExtension($asset_rev);