ite/js-bundle
A Laravel/PHP bundle for integrating and managing JavaScript assets in your application, simplifying script bundling and frontend asset delivery with minimal configuration.
View::share, a Blade <script>window.App = @json($config)</script>, or a small service provider plus a Blade directive. The existence of a dedicated bundle is evidence the need recurs across teams — not evidence a team needs a dependency to solve it.<script> blocks and their own escaping bugs.<script type="application/json"> island is a product-level decision about CSP strictness, cacheability, and page-weight budget, not an implementation detail.Consider adopting only if all of the following hold — which is unlikely for a Laravel product:
LICENSE file means default copyright applies, which blocks internal redistribution).</script> breakout and secret leakage are the two highest-severity failure modes.Look elsewhere (or build in-house) when:
symfony/* to ^6/^7; a bundle declaring symfony/symfony ~2.3 cannot co-resolve, and the Symfony 2 code itself likely trips on PHP 8 removals (each(), create_function(), curly-brace string offsets).@json/@js, Ziggy for named routes, Inertia's HandleInertiaRequests::share(), Vite define/import.meta.env for build-time constants, and an explicit opt-in allowlist in a service provider for anything broader.Recommendation: adopt the idea, reject the dependency. Reimplement the pattern in-house in roughly one engineering day.
ite/js-bundle is a Symfony 2 bundle — not a Laravel package — from an end-of-life framework generation, with negligible adoption (4 stars, 0 dependents), a near-zero package score, and no maintenance signal. On a Laravel codebase it cannot be installed without adaptation work exceeding the cost of writing the equivalent ourselves; a composer require will fail dependency resolution at best and produce a subtly broken autoloader at worst.
The problem it addresses is legitimate and recurring: getting server-side config — routes, flags, i18n strings, current user — into the browser in one predictable place. We should solve that deliberately with a small, tested in-house convention: a service provider exposing an explicit allowlist (never a denylist), a Blade directive or JSON <script type="application/json"> island, JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS|JSON_HEX_QUOT on encode, and a test asserting that secrets such as DB_PASSWORD, APP_KEY, and any *_SECRET can never be emitted. If the roadmap moves to Inertia or Livewire, that layer owns the bridge instead and we build nothing.
Cost of the recommended path: about one engineering day including tests and docs, versus indefinite ownership of a fork of an unmaintained EOL bundle. Low effort, low risk, and it leaves us free to migrate to a richer adapter later.
Three levers to govern once it ships, because this pattern has a history of production incidents:
Cache-Control: public must be partitioned or disabled. This is the most common way the pattern breaks in production.json_encode (non-UTF-8 data returns false), and pair the payload with a CSP that uses a nonce rather than unsafe-inline.Follow-up if any stakeholder wants to pursue the package itself: confirm the license, identify exactly what the emitted global contains (config scalars, translations, routes, or arbitrary container services — this determines the blast radius of a leak), and check whether any branch targets Symfony 4/5/6. Without a positive answer to the last question, the port is a clean-room rewrite, not an upgrade.
How can I help you explore Laravel packages today?