PHPackages                             metalmatze/laravel-html-cachebusting - 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. metalmatze/laravel-html-cachebusting

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

metalmatze/laravel-html-cachebusting
====================================

Extends laravel's HtmlBuilder with styleBust() &amp; scriptBust() which insert the file's md5 to the url.

v0.1.1(11y ago)181.7k1[1 issues](https://github.com/MetalMatze/laravel-html-cachebusting/issues)MITPHP

Since Jul 8Pushed 8y ago1 watchersCompare

[ Source](https://github.com/MetalMatze/laravel-html-cachebusting)[ Packagist](https://packagist.org/packages/metalmatze/laravel-html-cachebusting)[ RSS](/packages/metalmatze-laravel-html-cachebusting/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

laravel-html-cachebusting
=========================

[](#laravel-html-cachebusting)

**This repository is archived. If this is still a thing in 2017 and beyond, please contact me on [Twitter](https://twitter.com/MetalMatze). I might transfer this project to you!**

This package extends Laravel's `HtmlBuilder` with simple cache busting, either by enabling it via a configuration and using the built-in `HTML::script` and `HTML::style`, or more explicitly by replacing calls to `HTML::script` and `HTML::style` in templates with `HTML::scriptBust` and `HTML::styleBust`. Both methods bust browser cache by placing an md5 checksum into the filename of your asset.

For a cache buster providing more functionality, have a look at [Laravel Cachebuster](https://github.com/TheMonkeys/laravel-cachebuster).

[![Build Status](https://camo.githubusercontent.com/796a43086fcbea513ebf324a4104eee28aa4b4c95f59f0eb900938c333bff02c/68747470733a2f2f7472617669732d63692e6f72672f4d6574616c4d61747a652f6c61726176656c2d68746d6c2d636163686562757374696e672e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/MetalMatze/laravel-html-cachebusting)

### Cache busting via configuration

[](#cache-busting-via-configuration)

After installation of this package calls to `HTML::script` and `HTML::style` will *not* automatically apply cache busting. To change this, publish the package configuration using Artisan.

```
php artisan config:publish metalmatze/laravel-html-cachebusting

```

This copies the file `config.php` into `/packages/metalmatze/laravel-html-cachebusting`. Setting `enabled` to `true` enables cache busting for all calls to both `HTML::script` and `HTML::style`.

Aside from that the configuration requires a white-list of extensions that should be busted, which by default is set to .js and .css files.

And the `format` setting makes it possible to format the cache buster string *a little bit*; it is essentially an `sprintf` formatter, which expects exactly one `%s`.

### Explicit cache busting

[](#explicit-cache-busting)

**Note**: explicit cache busting overrides the `enabled` setting of the configuration file.

Busting cache for css files:

```
{{ HTML::styleBust('main.css') }}
```

``

Busting cache for javascript files:

```
{{ HTML::scriptBust('main.js') }}
```

``

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

[](#installation)

Begin by installing this package through Composer. Edit your project's `composer.json` file to require `metalmatze\laravel-html-cachebusting`.

```
"require": {
    "laravel/framework": "4.0.*",
    "metalmatze/laravel-html-cachebusting": "dev-master"
},
"minimum-stability" : "dev"

```

Next, update Composer from the Terminal:

```
composer update

```

Once this operation completes, the final step is to add the service provider. Open `app/config/app.php`, and **append** a new item to the providers array.

```
'MetalMatze\Html\HtmlServiceProvider'

```

**DO NOT replace it with laravel's default `Illuminate\Html\HtmlServiceProvider` since there would be no Form.**

### Adding the redirect to your `.htaccess`

[](#adding-the-redirect-to-your-htaccess)

```
RewriteRule ^(css|js)/(.+)\.([0-9a-f]{32})\.(js|css|png|jpg|gif)$ /(css|js)/$1.$3 [L]

```

### Adding the redirect to nginx

[](#adding-the-redirect-to-nginx)

```
rewrite "^(.+)\.([0-9a-f]{32})\.(js|css|png|jpg|gif)$" /$1.$3;

```

Contributing
------------

[](#contributing)

This package adheres to PSR-2 standards, so before committing make sure your code is PSR-2 error free. To test compliance run

```
php vendor/bin/phpcs --standard=PSR2 src/ tests/```.

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.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 ~59 days

Total

2

Last Release

4264d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1465c7b46bf2b7dee535fe0d2ccee59f47604a58bc2c0f4fedcd51664200b8c?d=identicon)[MetalMatze](/maintainers/MetalMatze)

---

Top Contributors

[![metalmatze](https://avatars.githubusercontent.com/u/872251?v=4)](https://github.com/metalmatze "metalmatze (15 commits)")[![edeckers](https://avatars.githubusercontent.com/u/202540?v=4)](https://github.com/edeckers "edeckers (11 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/metalmatze-laravel-html-cachebusting/health.svg)

```
[![Health](https://phpackages.com/badges/metalmatze-laravel-html-cachebusting/health.svg)](https://phpackages.com/packages/metalmatze-laravel-html-cachebusting)
```

###  Alternatives

[yajra/laravel-datatables-oracle

jQuery DataTables API for Laravel

4.9k33.8M338](/packages/yajra-laravel-datatables-oracle)[watson/active

Laravel helper for recognising the current route, controller and action

3253.6M14](/packages/watson-active)[illuminate/session

The Illuminate Session package.

9937.4M753](/packages/illuminate-session)[illuminatech/url-trailing-slash

Allows enforcing URL routes with or without trailing slash

50216.9k](/packages/illuminatech-url-trailing-slash)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7012.8k](/packages/tehwave-laravel-achievements)

PHPackages © 2026

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