Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Hashed Asset Bundle

Hashed Asset Bundle Laravel Package

incenteev/hashed-asset-bundle

incenteev/hashed-asset-bundle is a Symfony bundle for cache-busting static assets by generating and resolving hashed filenames. It helps serve versioned CSS, JavaScript, and images with long-lived browser caching while keeping templates clean and deployments predictable.

View on GitHub
Deep Wiki
Context7

Apply an asset version based on a hash of the asset for symfony/asset

Frequently asked questions about Hashed Asset Bundle
Does incenteev/hashed-asset-bundle work with Laravel?
No. It is a Symfony bundle that implements Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface and registers through symfony/framework-bundle, and it ships no Laravel service provider, facade, or config publishing. Laravel's asset() helper and Vite/Mix manifest pipeline never consult symfony/asset, so the strategy would not be invoked even if the package were autoloaded. Treat it as a reference implementation to port rather than a package to install.
Which Laravel versions does this package support?
None. There is no Laravel integration of any kind, so Laravel 8, 9, 10, 11, and later are all unsupported as shipped. The package targets Symfony applications, including Symfony-based Drupal and Ibexa installs, where symfony/asset is the URL generator. For Laravel you need a custom helper or the Vite manifest instead.
What is content-hash cache busting and why should I use it?
Content-hash cache busting rewrites asset filenames or URLs to include a hash derived from the file contents, so any change to a file produces a new URL. That lets you serve CSS, JavaScript, and images with long-lived or immutable Cache-Control headers, and clients fetch the new version immediately after deployment without manual version bumps. It is more reliable than timestamps or hand-managed query strings because the hash only changes when the bytes change.
How do I install incenteev/hashed-asset-bundle in a Symfony app?
Run composer require incenteev/hashed-asset-bundle, using v1.6.2 or later because earlier tags declared incorrect symfony/asset and symfony/cache version constraints. Register the bundle in config/bundles.php and configure the hashing version strategy so Symfony's asset packages resolve hashed URLs. There is a single configuration surface, no Node build step, and no JavaScript toolchain dependency.
How do I get hashed asset URLs in Laravel without this bundle?
Implement a small custom version strategy or helper that appends a hash of the file contents to asset() output, or rely on Laravel's Vite/Mix manifest, which already produces content-hashed filenames. The algorithm is roughly fifty lines: hash the file, cache the hash, and build the URL. Do not try to autoload this Symfony bundle into Laravel, because there is no service provider and nothing in Laravel's asset pipeline would call it.
Is incenteev/hashed-asset-bundle actively maintained?
It is a low-traffic, single-maintainer project with about 26 GitHub stars and zero dependents, so bus-factor risk is real. The v1.6.2 release was a dependency-constraint patch that arrived via an external contributor, which shows some responsiveness but does not resolve the single-maintainer concern. Review composer.lock if you are pinned to v1.6.1 or earlier, and plan for the possibility of adopting the code yourself.
Does the bundle compute asset hashes on every request?
Hashing is expensive if run on each request, so correctness and latency depend on caching or warming hashes at deploy time. The bundle relies on Symfony's cache layer for resolved hashes, and the v1.6.2 constraints touch symfony/cache, so verify your cache configuration. Measure cold-cache latency before production and make sure deployment invalidates the cache when asset files change.
How are missing assets handled, and is this safe for production?
Behavior for missing files depends on configuration and should be verified in your environment, so decide whether you want an exception, a silent fallback, or an unhashed URL. Path traversal and file-read behavior on missing or unexpected asset paths should be reviewed before production use. Since the code surface is small and MIT licensed, a security review is cheap and worth doing.
What are the alternatives to this bundle in Symfony?
Symfony's built-in json_manifest_path version strategy used by Webpack Encore and AssetMapper already produce content-hashed asset URLs in modern Symfony. This bundle's niche is narrow: Symfony apps without a Node build step and without AssetMapper. From EmptyVersionStrategy or StaticVersionStrategy the swap is configuration-only, but every asset URL changes shape, which invalidates CDN and browser caches.
Can I use this bundle in a mixed Laravel and Symfony estate?
Only in the Symfony services. Laravel's asset URL generation does not consult symfony/asset, so do not try to unify asset URL generation across both stacks with this package; use a Laravel-native helper or Vite manifest on the Laravel side. Treat the bundle as a reference implementation for the algorithm rather than a shared dependency.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo