2017 © Pedro PelĂĄez
 

library autoversion

Suffix asset file name with a timestamp to invalidate cache if a new asset is uploaded on the server.

image

stephanecoinon/autoversion

Suffix asset file name with a timestamp to invalidate cache if a new asset is uploaded on the server.

  • Saturday, July 15, 2017
  • by stephanecoinon
  • Repository
  • 1 Watchers
  • 1 Stars
  • 402 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

AutoVersion Build Status

Suffix asset file names with a timestamp to invalidate cache if a new asset is uploaded on the server., (*1)

When you include assets like images, stylesheets or javascripts, your website visitors might not see new changes depending on their browser cache settings. AutoVersion will force the cache to invalidate., (*2)

Installation

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

composer require "stephanecoinon/autoversion":"dev-master"

Configuration

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

// Auto-load composer packages
require 'vendor/autoload.php';

// Configure the document root
AutoVersion::setDocumentRoot('/var/www/html/public');

And if you're using the excellent Laravel framework, it's even simpler: just add the service provider in app/config/app.php:, (*5)

'providers' => array(

    // Your current providers are here ...

    'Coinon\AutoVersion\AutoVersionServiceProvider',
),

The service provider will take care of: * automatically loading the package * configuring the document root to public_path() * adding the AutoVersion class as an alias making it accessible easily from anywhere, (*6)

Usage

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

// $pathToAsset is relative to the document root configured above
AutoVersion::asset($pathToAsset);

for example:, (*8)

<link rel="stylesheet" href="<?=AutoVersion::asset('css/main.css') ?>">

Or with Laravel blade:, (*9)

{{ HTML::style(AutoVersion::asset('css/main.css')) }}

The Versions

15/07 2017

dev-master

9999999-dev https://github.com/stephanecoinon/autoversion

Suffix asset file name with a timestamp to invalidate cache if a new asset is uploaded on the server.

  Sources   Download

MIT

The Requires

 

The Development Requires

  • mikey179/vfsstream dev-master

by Stéphane Coinon

17/07 2014

0.1.0

0.1.0.0

Prefix asset file name with a timestamp to invalidate cache if a new asset is uploaded on the server.

  Sources   Download

The Requires

  • php >=5.4.0

 

The Development Requires

  • mikey179/vfsstream dev-master

by Stéphane Coinon