- Is miguel/assetic-angular-js-bundle a Laravel package?
- No. It is a Symfony bundle (Composer type symfony-bundle) that registers through Symfony's Bundle and DependencyInjection conventions and wires an Assetic filter into Symfony's Assetic bundle pipeline. Laravel has no bundle registration and no equivalent auto-discovery hook, so the package will not bootstrap inside a Laravel application. The only genuinely portable piece is the Assetic filter class itself, which is roughly 150 lines of escaping and $templateCache generation.
- Can I install it in a Laravel project with Composer?
- You can run composer require, but expect problems. The package pulls a transitive dependency on symfony/http-kernel and carries a PHP constraint that may conflict with Laravel's ^8.1 floor, forcing --ignore-platform-reqs, which is a red flag to carry into a production build. Even if it resolves, nothing will register the bundle or wire the filter into a pipeline for you. Vendoring or reimplementing the filter is the defensible path.
- What does the Assetic AngularJS filter actually do?
- It reads AngularJS HTML template files and emits $templateCache.put('<key>', '<markup>') calls so templates ship inside your JavaScript bundle instead of being fetched over HTTP. That removes a round trip per templateUrl and lets directives render without a template request. The entire value of the package is that string transformation, and there is no runtime component.
- How do I use this filter without Symfony?
- You can hand-instantiate the filter class inside a standalone Assetic pipeline, but you inherit Symfony-only classes and a symfony/http-kernel dependency for zero runtime benefit. In practice it is faster to read the filter and reimplement the escaping and cache-key logic directly in your own build step. That is about 50 lines of string work.
- How do I generate the AngularJS $templateCache in a Laravel build with Vite?
- Write a small Vite plugin, or an Artisan command that runs during the build, that globs your HTML templates and emits a templates.js module containing $templateCache.put calls, then import that module after your angular.module definition. Freeze the cache-key format as an explicit contract before you start, because a mismatch with your templateUrl strings is the most common failure. Run the old generator and the new one against the same template set and diff the emitted keys and payloads. Delete the dependency once the output matches.
- Does it support PHP 8.1 and Laravel 10 or 11?
- There is no evidence of PHP 8.x validation in the repository, and the package predates modern Laravel versions. Its PHP constraint will likely conflict with Laravel's ^8.1 floor, so Composer will either refuse resolution or require --ignore-platform-reqs. Compatibility with current Asseti releases is also unverified. Assume it does not support modern Laravel and plan accordingly.
- What cache-key format does the generated $templateCache output use?
- This is the detail you must verify before trusting the package. Depending on the filter configuration, keys may be prefixed with a leading slash or made relative to a configured root, and they must exactly match the templateUrl strings your components actually request. Check whether it recurses into nested directories and whether it normalizes Windows path separators. Getting this wrong produces a broken build or silently missing templates.
- Is it safe to use in production?
- Lifecycle risk is high but blast radius is low. The repository shows zero stars, zero dependents and zero forks, with no maintainers, no CVE response path and no evidence of PHP 8.x validation. Assetic itself is a legacy pipeline superseded by Webpack Encore and, in the Laravel world, Mix and Vite, and AngularJS reached end of life on 2021-12-31. Because the filter is a build-time transform with no runtime footprint, a failure shows up as a broken build or a missing template rather than a production outage, and the MIT license makes forking or vendoring legally clean.
- What are the alternatives for preloading AngularJS templates?
- In a Laravel app the idiomatic route is Vite on Laravel 10 and 11, or Mix on legacy projects, combined with a template-preloading plugin or a short custom transform that emits the same $templateCache module. Outside Laravel, gulp-angular-templatecache and grunt-angular-templates do the same job, and Webpack has ngtemplate-loader. Any of these is a better bet than a Symfony bundle whose only real value is a handful of string operations.
- How much work is it to reimplement the filter myself?
- The portable artifact is a single Assetic FilterInterface implementation that reads template HTML, escapes it and emits $templateCache.put calls, realistically under about 150 lines, with the escaping and cache-key logic accounting for roughly 50. Watch how it escapes single quotes, newlines and backslashes, and confirm that escaping holds for templates containing inline script tags or SVG. A few hours of vendoring work beats a permanent dependency on an unmaintained artifact.