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

Js Twig Bundle Laravel Package

survos/js-twig-bundle

A Symfony bundle from Survos that streamlines integrating JavaScript into Twig templates, with helpers and configuration for managing scripts, assets, and dynamic front-end behavior alongside your Twig views.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Server/browser template parity (feature scope): The bundle lets one Twig template render both server-side in Symfony and client-side via Twig.js from a Stimulus controller, using path(), stimulus_* and ux_icon helpers. Product implication: partial-refresh and interactive flows (search filters, pagination, modals, inline edits) can reuse the exact markup already approved for server rendering instead of a second JS template set. Scope decisions should assume "one template, two renderers" — that is the core value proposition, and it shrinks the surface of any UI feature that needs to be re-rendered without a full page load.
  • Build vs. buy (tooling): The strongest PM-relevant claim is no build step — routes load as JSON through AssetMapper and rendering happens in the browser. This is a direct substitute for standing up a Node/esbuild/Webpack pipeline plus a JS templating layer. Frame it as: adopt a small bundle now versus funding pipeline maintenance and duplicate markup. Given the signals (0 stars, low score, single-maintainer ecosystem), the realistic comparison is bundle vs. a small internal helper of comparable size, not bundle vs. a platform.
  • Roadmap input — interactivity without an SPA rewrite: It supports a staged roadmap where you add progressive interactivity to an existing Twig application rather than committing to Inertia/React/Vue. That is a strategic lever worth evaluating explicitly: it buys time and preserves server-rendered SEO/accessibility while raising the ceiling on client-side responsiveness.
  • Use cases worth piloting: filtered/searched result lists, cart or notification badges refreshed by fetch, modal and drawer content, dashboards that re-render a table body after a mutation — all in Twig-heavy Symfony teams light on JS depth.
  • What this package should not drive: The 1.6.0 note ("Hack (not via survos) to remove dumps") is a maintenance signal about debug output, not a product capability. Do not let it anchor a CI-hygiene initiative, and don't let it be the reason the package is evaluated. It is also not a Laravel package — any decision framed around Laravel/Blade should be redirected before it reaches a roadmap review.

When to Consider This Package

Consider adoption when:

  • Your stack is Symfony with Twig, and AssetMapper/importmap plus Stimulus (Symfony UX) are already in place — this is the environment the bundle assumes.
  • You have genuinely duplicated markup across Twig partials and JS template strings, and closing that gap is a recurring tax on feature delivery.
  • "No build step" is a real constraint (small team, no frontend specialist, deployment simplicity valued).
  • You accept community-maintained dependencies and will pin versions, review diffs, and keep the option to fork or vendor.
  • You can run a bounded pilot on two or three non-critical interactive surfaces before broad adoption.

Look elsewhere when:

  • The application is Laravel — this bundle does not serve Blade/Composer-Laravel conventions; the equivalent conversation is Livewire, Inertia, or Alpine plus a JSON API.
  • Turbo/Hotwire frames or morphing already solve your partial-update needs with less new surface area.
  • Your templates rely on macros, custom filters/extensions, or heavy includes that Twig.js cannot faithfully reproduce — parity will break in ways that are hard to test.
  • Escaping/security parity between Twig (server) and Twig.js (browser) is unproven for user-supplied content. If you render untrusted data client-side, treat this as a blocker until you have an explicit XSS review.
  • You need vendor support, an SLA, an active security response process, or a healthy contributor base — 0 stars and a low maturity score do not provide those.

How to Pitch It (Stakeholders)

For executives: This is a small integration bundle that would let us render the same Twig templates in the browser that we already render on the server, so interactive features stop requiring a second copy of the markup and a separate JavaScript build pipeline. The strategic value is optionality: it lets us add responsiveness to the existing server-rendered product without committing to a single-page-app rewrite. The risk side is maturity — the project has no meaningful community traction, one ecosystem's worth of maintenance, and a recent release whose only note describes a workaround ("hack") rather than a feature. Recommendation: fund a time-boxed pilot on one or two interactive surfaces, keep it out of critical paths, and hold a decision point comparing it against a small internal helper. It is not core infrastructure.

For engineering: Adopt only if we are on Symfony with Twig, AssetMapper and Stimulus already in use. Pin the version, read the diff for the 1.6.0 "remove dumps" hack since it indicates the codebase carries debug residue and unreviewed workarounds, and confirm PHP/Symfony constraints in composer.json before upgrading. Prioritize two validation tasks: (1) an escaping/XSS comparison between server Twig and Twig.js for any user-supplied values passed through path(), stimulus_* and ux_icon; (2) a feature-parity check on the specific templates we intend to share, since unsupported filters or macros fail silently at runtime rather than at build time. Without a build step, asset and cache behavior differs from our usual pipeline — expect debugging friction. Keep the fallback documented up front: JSON endpoints plus small client-side templates, or a thin in-house render helper, so a maintenance stall is a contained cost rather than a blocked roadmap item.

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.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package