PHP Classes
elePHPant
Icontem

Legato PHP Asset Management: Get versioned URLs for CSS, JavaScript and images

Recommend this page to a friend!
  Info   View files Example   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2018-06-18 (2 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 71 This week: 1All time: 9,182 This week: 468Up
Version License PHP version Categories
legato-asset 1.0.0MIT/X Consortium ...5.3.9HTML, PHP 5
Description Author

This package can get versioned URLs for CSS, JavaScript and images.

It can take the name of a file to be served as part of a Web page like an image, CSS or JavaScript and returns a URL to be used in the page to refer to those asset files.

The class serve the specified asset files from the generated URLs.

Those URLs include a parameter with a value that may be passed to the package explicitly or be generated by it using a random value.

Name: Ogbemudia Osayawe <contact>
Classes: 1 package by
Country: Malaysia Malaysia

Details

Legato Asset

A simple tool for generating unique versioned URLs for images, stylesheet, javascript, etc.

Installation

composer require legato/asset

Usage


Relative Path
<link href="<?= asset('css/style.css') ?>" rel="stylesheet">

Absolute Path
<link href="<?= asset('/css/style.css') ?>" rel="stylesheet">

Relative Path Output

css/style.css?7ddf32e17a6ac5ce04a8ecbf782ca509

<link href="css/style.css?7ddf32e17a6ac5ce04a8ecbf782ca509" rel="stylesheet">

Absolute Path Output

/css/style.css?7ddf32e17a6ac5ce04a8ecbf782ca509

<link href="/css/style.css?7ddf32e17a6ac5ce04a8ecbf782ca509" rel="stylesheet">

Specifying A query String


<link href="<?= asset('css/style.css', 'v1') ?>" rel="stylesheet">

css/style.css?v1=7ddf32e17a6ac5ce04a8ecbf782ca509

<link href="css/style.css?v1=7ddf32e17a6ac5ce04a8ecbf782ca509" rel="stylesheet">

  Files folder image Files  
File Role Description
Files folder imageexample (1 file, 2 directories)
Files folder imagesrc (2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file readme.md Doc. Documentation

  Files folder image Files  /  example  
File Role Description
Files folder imagecss (1 file)
Files folder imagejs (1 file)
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files  /  example  /  css  
File Role Description
  Accessible without login Plain text file style.css Data Auxiliary data

  Files folder image Files  /  example  /  js  
File Role Description
  Accessible without login Plain text file script.js Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageasset (3 files)
Files folder imagefunctions (1 directory)

  Files folder image Files  /  src  /  asset  
File Role Description
  Plain text file Asset.php Class Class source
  Plain text file AssetStrategyContract.php Class Class source
  Plain text file StaticVersionStrategy.php Class Class source

  Files folder image Files  /  src  /  functions  
File Role Description
Files folder imageasset (1 file)

  Files folder image Files  /  src  /  functions  /  asset  
File Role Description
  Accessible without login Plain text file helpers.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:71
This week:1
All time:9,182
This week:468Up