PHPackages                             paulbunyannet/autoversion - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. paulbunyannet/autoversion

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

paulbunyannet/autoversion
=========================

Auto versioning class for front end assets.

1.2.0(10y ago)028.4k[1 issues](https://github.com/paulbunyannet/autoversion/issues)MITPHPPHP &gt;=5.4.0

Since Sep 22Pushed 10y ago1 watchersCompare

[ Source](https://github.com/paulbunyannet/autoversion)[ Packagist](https://packagist.org/packages/paulbunyannet/autoversion)[ RSS](/packages/paulbunyannet-autoversion/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

\#paulbunyannet/autoversion

[![Build Status](https://camo.githubusercontent.com/03ba49f51e4475c2e7f1e66220680a3a6c6e6b30308a9be57f909b25e2032a0b/68747470733a2f2f7472617669732d63692e6f72672f7061756c62756e79616e6e65742f6175746f76657273696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/paulbunyannet/autoversion)[![Latest Version](https://camo.githubusercontent.com/cf9cf8d68ec5175eaf37e28c7db81f0279b2a59d330e90d19b2d78d8a266d95e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061756c62756e79616e6e65742f6175746f76657273696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/paulbunyannet/autoversion)

**paulbunyannet/autoversion** Cache busting mechanisim for front end assets, used with the cache busting mechanism provided by the HTML5 Boilerplate Apache [.htaccess configuration](https://github.com/h5bp/server-configs-apache/blob/master/dist/.htaccess#L968-L984).

Installation
------------

[](#installation)

In your terminal, just run:

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

Configuration
-------------

[](#configuration)

This package is framework agnostic, the configuration process is:

```
// 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

```

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

```

Usage
-----

[](#usage)

In your views, just call:

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

for example:

```
