jmikola/js-assets-helper-bundle
A Symfony bundle that integrates the JavaScript assets helper, providing convenient service and template support for managing and rendering JavaScript asset references in your application.
AssetsHelper reachable from JavaScript so front-end code can build relative or absolute asset URIs (respecting the configured base path, CDN prefix, and version/package resolution) at runtime rather than hardcoding paths. This matters for features where the asset is chosen after page render: lazy-loaded images, sprite/icon selection driven by state, video/audio source swapping, JS-side template or partial loading, and any widget that constructs URLs from user interaction./images/foo.png" regressions. It makes the asset base URL and version string a server-owned configuration instead of a duplicated constant that drifts between Twig and JS.<meta> tag or data- attribute and read it in JS. Treat "adopt" as a decision to keep one source of truth for asset URLs, not a decision to add a dependency. This package only wins if you want that logic to stay inside Symfony's asset configuration rather than reimplementing it.asset()/mix()/vite() output to the front end via a manifest endpoint or inline config. The product need is real and recurring; this specific artifact does not satisfy it on Laravel.Consider it only when all of the following hold:
AssetsHelper.Look elsewhere when:
asset()/Vite manifest and skip the dependency.manifest.json and import.meta.url-style resolution; adding a server-side helper to JS duplicates a problem the bundler already solved.To executives: This is a small, MIT-licensed utility that closes a specific gap — keeping JavaScript-generated asset URLs in sync with server-side asset configuration (CDN prefixes, cache-busting versions) so a CDN or versioning migration doesn't quietly break images and media loaded by the front end. It is low-cost and low-risk to adopt, but it is legacy-scoped: it serves a Symfony 2 estate only. Do not treat it as a foundation for new work, and do not expect vendor support. Recommended framing: a tactical fix for an existing Symfony 2 application, with roughly one day of in-house glue as the fallback if we'd rather not carry a stale dependency.
To engineering: It's a thin bundle that exposes the templating AssetsHelper to client-side JS. Costs: one dependency, one config block, and accepting a single-maintainer bundle last touched in the Symfony 2 era. The honest comparison is our own two-line config dump (<meta name="asset-base"> + version string) — which we'd need anyway on Laravel, where this package does not apply. Pick this if we want asset package/version resolution to remain server-authoritative and are willing to fork it if it breaks; pick the meta-tag approach if we want zero dependency risk. On a Laravel stack the answer is the Laravel-native path: Vite manifest for build-time hashed paths, an optional cached manifest/base-URL endpoint for runtime resolution, and a small owned asset() module. Either way, the architectural decision is the same: one source of truth for asset URLs across server and client.
How can I help you explore Laravel packages today?