PHPackages                             jhancock/yii2-version-assetmgr - 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. jhancock/yii2-version-assetmgr

AbandonedArchivedYii2-extension[Utility &amp; Helpers](/categories/utility)

jhancock/yii2-version-assetmgr
==============================

Yii2 asset manager that hashes based on application version instead of mtime. Useful for load balanced sites.

1.0.0(11y ago)621.8k↓39.2%1BSD-3-ClausePHP

Since Aug 14Pushed 11y ago2 watchersCompare

[ Source](https://github.com/jasonhancock/yii2-version-assetmgr)[ Packagist](https://packagist.org/packages/jhancock/yii2-version-assetmgr)[ Docs](https://github.com/jasonhancock/yii2-version-assetmgr)[ RSS](/packages/jhancock-yii2-version-assetmgr/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

yii2-version-assetmgr
=====================

[](#yii2-version-assetmgr)

A drop in replacement AssetManager for the Yii2 framework. Yii's default AssetManager hashes assets based on path + Yii version + file modification time, but if your website is being served behind a load balancer from multiple web servers and the file mtimes are different, this could lead to serving assets from different paths.

To combat this, instead the VersionAssetManager hashes path + Yii version + application version. Application version is read from the `version` key of the `params` array from the configuration file:

```
'params' => [
    'version' => '1.0.0'
],

```

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist jhancock/yii2-version-assetmgr "*"

```

or add

```
"jhancock/yii2-version-assetmgr": "*"

```

to the require section of your `composer.json` file.

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

[](#configuration)

Configure your application to use the VersionAssetManager by adding the following component configuration:

```
'assetManager' => [
    'class' => 'jhancock\VersionAssetMgr\VersionAssetManager',
],

```

You should then set a `version` parameter in the `params` array when you publish your application.

In the development environment, either omit setting the `version` key in the config, set it to `Development`, or omit it altogether and it will default to `Development`. When the version is `Development`, we instead hash path + Yii version + time() to guarantee that we always bust cache in the development environment. This means that every pageload will create new folders under your `assets` directory and copy lots of files. It is therefore recommended that you turn on symlinking by setting `linkAssets` to `true` under the `assetManager`component configuration like so:

```
'assetManager' => [
    'class' => 'jhancock\VersionAssetMgr\VersionAssetManager',
    'linkAssets' => true,
],

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity63

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4296d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/27539?v=4)[Jon Hancock](/maintainers/jhancock)[@jhancock](https://github.com/jhancock)

---

Tags

yii2assetmanager

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jhancock-yii2-version-assetmgr/health.svg)

```
[![Health](https://phpackages.com/badges/jhancock-yii2-version-assetmgr/health.svg)](https://phpackages.com/packages/jhancock-yii2-version-assetmgr)
```

###  Alternatives

[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
