PHPackages                             newism/craft3-asset-rev - 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. newism/craft3-asset-rev

AbandonedCraft-plugin

newism/craft3-asset-rev
=======================

Rev asset urls with timestamps

0.0.7(5y ago)58.4k[2 issues](https://github.com/newism/craft3-asset-rev/issues)MITPHPCI failing

Since Jun 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/newism/craft3-asset-rev)[ Packagist](https://packagist.org/packages/newism/craft3-asset-rev)[ RSS](/packages/newism-craft3-asset-rev/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (7)Dependencies (1)Versions (8)Used By (0)

NSM Asset Rev plugin for Craft CMS 3.x
======================================

[](#nsm-asset-rev-plugin-for-craft-cms-3x)

Asset Models
------------

[](#asset-models)

Rev `Asset` model urls with date modified timestamps. Its simple… just call the function and pass the asset and an optional transform.

Before:

```
Template: {{ asset.url(transform) }}
Output: https://local.craft3/uploads/biggie.jpg

```

After:

```
Template: {{ nsm_rev_asset_url(asset, transform) }}
Output: https://local.craft3/uploads/biggie.1496670969.jpg

```

Manifest Files
--------------

[](#manifest-files)

Additionally NSM Asset Rev can check a manifest file for urls and return the marching revved url.

Manifest:

```
{ "app.css": "app.1e9915c1398b2ba2fcc2.css" }

```

Before:

```
Template: {{ url(app.css) }}
Output: https://local.craft3/app.css

```

After:

```
Template: {{ nsm_rev_manifest_url('app.css') }}
Output: https://local.craft3/app.1e9915c1398b2ba2fcc2.css

```

Manifest files will most likely be created from a build process.

Here's some examples:

- [grunt-filerev-assets](https://github.com/richardbolt/grunt-filerev-assets)
- [gulp-rev](https://github.com/sindresorhus/gulp-rev)
- [webpack-manifest-plugin](https://github.com/danethurber/webpack-manifest-plugin)

Note: NSM Asset Rev only supports one level key: value pairs.

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

[](#installation)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require newism/craft3-asset-rev
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

### Step 2: Install

[](#step-2-install)

Install plugin in the Craft Control Panel under Settings &gt; Plugins.

Usage
-----

[](#usage)

### Twig template functions

[](#twig-template-functions)

This plugin provides two twig functions.

#### Asset Models

[](#asset-models-1)

```
{{ nsm_rev_asset_url(asset, transform) }}

```

#### Manifest Files

[](#manifest-files-1)

```
{{ nsm_rev_manifest_url(url) }}

```

#### Helper

[](#helper)

There's actually three twig functions :). The third is a helper that either calls `nsm_rev_asset_url` or `nsm_rev_manifest_url` based on the arguments.

If the first argument is an `Assetl` then `nsm_rev_asset_url` will be called internally:

```
Template: {{ nsm_rev_url(asset, transform) }}
Output: https://local.craft3/uploads/biggie.1496670969.jpg

```

If the first argument is an `string` model then `nsm_rev_manifest_url` will be called internally:

```
Template: {{ nsm_rev_url('app.css') }}
Output: https://local.craft3/app.1e9915c1398b2ba2fcc2.css

```

### Server Configuration

[](#server-configuration)

**Important**: This plugin doesn't actually change the the filename on the server. You'll need to implement rewrite rules in your apache conf or nginx access.

#### Apache

[](#apache)

See:

```
# ----------------------------------------------------------------------
# | Filename-based cache busting                                       |
# ----------------------------------------------------------------------

# If you're not using a build process to manage your filename version
# revving, you might want to consider enabling the following directives
# to route all requests such as `/style.12345.css` to `/style.css`.
#
# To understand why this is important and even a better solution than
# using something like `*.css?v231`, please see:
# http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

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

```

#### NGINX

[](#nginx)

See:

```
# Built-in filename-based cache busting

# This will route all requests for /css/style.20120716.css to /css/style.css
# Read also this: github.com/h5bp/html5-boilerplate/wiki/cachebusting
# This is not included by default, because it'd be better if you use the build
# script to manage the file names.
location ~* (.+)\.(?:\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$ {
  try_files $uri $1.$2;
}

```

Plugin Configuration
--------------------

[](#plugin-configuration)

See [./src/config.php](./src/config.php).

Road Map
--------

[](#road-map)

Some things to do, and ideas for potential features:

### 1.0

[](#10)

- Release it

### Future

[](#future)

- [Add manfiest based revving](https://github.com/newism/craft3-asset-rev/issues/1)
- Integrate other 3rd party image manipulation plugins as they become available

Credits
-------

[](#credits)

Brought to you by [Newism](http://newism.com.au)

[![](https://camo.githubusercontent.com/c03fd457cd8200454086f64bc5b6efa93d53368f9a8af669fc6d418f917bab9f/687474703a2f2f6e657769736d2e636f6d2e61752f75706c6f6164732f636f6e74656e742f6e657769736d2d6c6f676f2e706e67)](http://newism.com.au/)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.7% of commits — single point of failure

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

Every ~204 days

Recently: every ~297 days

Total

7

Last Release

2040d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/54c91398084bc17848b56c2dc015c3c257fb5871f246f7296a99f1ceba072e4f?d=identicon)[leevigraham](/maintainers/leevigraham)

---

Top Contributors

[![leevigraham](https://avatars.githubusercontent.com/u/25124?v=4)](https://github.com/leevigraham "leevigraham (22 commits)")[![brandonkelly](https://avatars.githubusercontent.com/u/47792?v=4)](https://github.com/brandonkelly "brandonkelly (1 commits)")

---

Tags

craft-plugincraft3craftcmscmsCraftcraftcmscraft-pluginnsm-asset-rev

### Embed Badge

![Health badge](/badges/newism-craft3-asset-rev/health.svg)

```
[![Health](https://phpackages.com/badges/newism-craft3-asset-rev/health.svg)](https://phpackages.com/packages/newism-craft3-asset-rev)
```

###  Alternatives

[nystudio107/craft-seomatic

SEOmatic facilitates modern SEO best practices &amp; implementation for Craft CMS 5. It is a turnkey SEO system that is comprehensive, powerful, and flexible.

1741.4M46](/packages/nystudio107-craft-seomatic)[verbb/image-resizer

Resize assets when they are uploaded.

127269.1k7](/packages/verbb-image-resizer)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[wrav/oembed

A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.

36205.0k3](/packages/wrav-oembed)[verbb/hyper

A user-friendly links field for Craft.

24130.9k9](/packages/verbb-hyper)[verbb/social-poster

Automatically post entries to social media.

918.5k](/packages/verbb-social-poster)

PHPackages © 2026

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