- What does spekkionu/assetcachebuster do for Laravel asset caching?
- It is a Laravel package that appends a unique, build-specific hash to asset URLs so browsers request fresh CSS and JS files after a deployment instead of serving stale cached copies. It wraps Laravel's asset() output with that fingerprint and ships a service provider, a config file, and a helper or Blade directive. The scope is intentionally narrow: cache-busting asset URLs, nothing more.
- How do I install and configure assetcachebuster in a Laravel app?
- Install it with Composer using composer require spekkionu/assetcachebuster, then register the package's service provider in the providers array of config/app.php, which is the standard Laravel 4.x and 5.0 flow. Publish or edit the package config to point at the asset directory or build stamp used to derive the hash. Because the package predates package auto-discovery, the manual provider entry is required.
- Which Laravel and PHP versions does assetcachebuster support?
- The last release was February 2015, so its constraints target the Laravel 4.x and early Laravel 5.0 era along with the PHP versions current at that time. It is not a good fit for Laravel 5.4+ apps using Mix or Laravel 9+ apps using Vite, both of which ship native content-hashed assets. Treat it as a legacy-only dependency.
- Can I install assetcachebuster on Laravel 10 or 11 with PHP 8?
- No, not cleanly. Composer resolution will typically fail on the illuminate/support and php version constraints, and forcing it with --ignore-platform-reqs exposes you to facade and container API drift that the package's tests do not cover. On a modern stack the correct move is to use Vite's @vite directive or Mix's mix() helper, or fork and port the small amount of logic you actually need.
- How does assetcachebuster generate the cache-busting hash?
- The package derives a hash from the asset directory or a build stamp and prefixes it onto asset URLs. The important detail to check in your config is whether that hash is computed once at build or boot time, or recomputed on each request. Per-request hashing adds I/O overhead and can produce divergent hashes across multiple app servers if the stamp is computed locally instead of being baked into the build artifact.
- Does assetcachebuster override Laravel's asset() helper?
- The package provides its own helper or Blade directive that wraps and rewrites asset() output rather than replacing the framework's global helper outright. Before adopting it, grep your codebase for every call site that uses the package's helper or directive, since that is your real migration surface. Also confirm nothing else in the app relies on the rewritten URL format, such as cached HTML fragments or CDN rewrite rules.
- What are the best alternatives to assetcachebuster for cache busting in Laravel?
- For Laravel 5.4 and later, Mix's mix() helper produces content-hashed filenames and rewrites URLs at build time; for Laravel 9 and later, Vite's @vite directive does the same via a manifest. Both are first-party, maintained, and remove the need for a runtime hash entirely. If you have only a few assets outside the bundler, a small in-house helper with a test is usually cheaper and safer than an abandoned third-party package.
- Is spekkionu/assetcachebuster still maintained and safe for production?
- The package has not had a release since February 2015, has no active maintainer, and effectively has a bus factor of one. The code surface is small enough to audit in an afternoon, but an unmaintained Composer dependency is a recurring cost on every PHP upgrade and a standing finding in dependency scanning. For anything beyond a frozen legacy app, avoid adding it to production.
- How do I migrate away from assetcachebuster to mix() or @vite?
- Start by inventorying every usage of the package's helper or Blade directive, then verify what the native alternative produces for each of those call sites. Replace them with asset(), mix(), or @vite, remove the service provider from config/app.php, and delete the hash-generation config and any cron or build step that wrote the stamp. For call sites with no native equivalent, such as assets served from an external CDN bucket, extract the hash-prefixing logic into a small internal helper with tests so the behavior survives without the dependency.
- Can I fork assetcachebuster or use it for CDN-hosted assets?
- Yes, forking is reasonable because the codebase is small and the logic is simple to audit, but check the license and upstream provenance first. The package only rewrites URLs produced by asset(), so assets served from a CDN or outside public/ need the hash applied manually at the edge or in a custom helper. If you do fork, pin the hash at build time rather than per request so every node serves identical URLs.