2017 © Pedro Peláez
 

library autoversion

Auto versioning class for front end assets.

image

paulbunyannet/autoversion

Auto versioning class for front end assets.

  • Wednesday, October 14, 2015
  • by paulbunyannet
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3,144 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 8 % Grown

The README.md

paulbunyannet/autoversion

Build Status Latest Version, (*1)

paulbunyannet/autoversion Cache busting mechanisim for front end assets, used with the cache busting mechanism provided by the HTML5 Boilerplate Apache .htaccess configuration., (*2)

Installation

In your terminal, just run:, (*3)

composer require "paulbunyannet/autoversion":"~1.0"

Configuration

This package is framework agnostic, the configuration process is:, (*4)

// Auto-load composer packages
use Pbc\AutoVersion\AutoVersion;
require 'vendor/autoload.php';

// Create new AutoVersion object and configure the document root
$auto = new AutoVersion($_SERVER['DOCUMENT_ROOT']);

Add to your .htaccess file, before any other routing mod rewrites, (*5)

<IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteRule ^(.+)\.(\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$ $1.$3 [L]
</IfModule>

Usage

In your views, just call:, (*6)

// $pathToAsset is relative to the document root configured above, 
$auto->file($pathToAsset);

for example:, (*7)

<link rel="stylesheet" href="<?=$auto->file('/css/main.css') ?>">
<script src="<?=$auto->file('/js/main.js') ?>"></script>

which will output file names with their modified time appended to file name:, (*8)

<link rel="stylesheet" href="/css/main.1234567890.css">
<script src="/js/main.1234567890.js"></script>

The Versions

14/10 2015

dev-master

9999999-dev

Auto versioning class for front end assets.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by naten

08/10 2015

1.2.0

1.2.0.0

Auto versioning class for front end assets.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by naten

28/09 2015

1.1.0

1.1.0.0

Auto versioning class for front end assets.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by naten

22/09 2015

1.0.0

1.0.0.0

Auto versioning class for front end assets.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by naten