PHP Classes
elePHPant
Icontem

File: src/functions/asset/helpers.php

Recommend this page to a friend!
  Classes of Ogbemudia Osayawe  >  Legato PHP Asset Management  >  src/functions/asset/helpers.php  >  Download  
File: src/functions/asset/helpers.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Legato PHP Asset Management
Get versioned URLs for CSS, JavaScript and images
Author: By
Last change:
Date: 10 months ago
Size: 463 bytes
 

Contents

Class file image Download
<?php

if(!file_exists('asset')){

   
/**
     * Get versioned url for assets
     *
     * @param $path
     * @param $query
     * @return string
     */
   
function asset($path, $query = null)
    {
       
$version = is_null($query) ? "%s?%s" : "%s?$query=%s";
       
$random = md5('random');

       
$strategy = new \Legato\Framework\src\asset\StaticVersionStrategy(
           
$random, $version
       
);

        return
$strategy->url($path);
    }
}