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

Twig Extension Bundle Laravel Package

jasonroman/twig-extension-bundle

A Symfony bundle that integrates custom Twig extensions into your templating layer, making it easy to register and use additional filters, functions, and tags while keeping extension configuration centralized.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit — poor, with a caveat. This is a Symfony2 bundle, not a Laravel package. Symfony bundles depend on Kernel bootstrapping, DependencyInjection\Extension classes, compiler passes, and service tags (twig.extension) to auto-register into Twig. Laravel has no bundle system, no compiler-pass pipeline, and no Twig in core — it ships Blade. Adopting this package means introducing two layers Laravel does not natively have: a Twig runtime (via rcrowe/twigbridge or equivalent) and a Symfony DI shim to satisfy the bundle's registration contract. The bundle itself is likely thin — a container of Twig filters/functions — so the ratio of integration machinery to actual functionality is unfavorable.

Integration feasibility — technically possible, practically not worth it. The bundle's real IP is the extension classes (string/date/formatting filters). Those classes are plausibly framework-agnostic and can be lifted out and registered manually in a Laravel service provider (Twig::addExtension) with a few hours of work. Trying to consume the bundle as a bundle is the expensive path. Rough sizing:

  • Extract-and-reimplement filters directly (or as Blade directives): ~1–3 engineering days, low risk.
  • Force the bundle through a Symfony-DI compatibility shim inside Laravel: ~2–3 weeks with meaningful uncertainty, no upstream support.

Technical risk — high, concentrated in lifecycle rather than security. Symfony 2.x is end-of-life (2.8 LTS support ended 2018), and the package's composer constraints almost certainly target PHP 5.x and Twig 1.x/2.x. Under PHP 8+ you should expect hard failures from removed functions, implicit nullable parameters, and dynamic property deprecations. Twig 3 removed Twig_Extension and the getName() contract, which breaks the bundle's registration model outright. The supply-chain surface is small (MIT, few or no transitive dependencies, zero dependents means no inherited attack surface), but the maintenance risk is total: 0 stars, 0 dependents, no evidence of recent releases, tests, or CI. There is no community signal to validate correctness of the filter implementations — date/timezone and string-manipulation filters are exactly where subtle correctness bugs hide and where you want test coverage you can inspect.

Key questions for the maintainer (if any engagement is contemplated):

  1. What PHP and Twig version ranges do the current composer constraints permit, and is there a tagged release compatible with Twig 3?
  2. Are the extension classes free of Symfony container coupling, or do they resolve collaborators from the container at runtime?
  3. Is there a test suite, and does it cover timezone/locale/unicode edge cases in the filter set?
  4. Is the repository archived, or is there a stated maintenance commitment?
  5. What is the complete list of filters/functions provided, so we can scope a native port precisely?

Integration Approach

Stack fit — mismatch by default; resolve it at the boundary. A Laravel application's rendering layer is Blade. Twig in Laravel is a deliberate, minority architectural choice supported by rcrowe/twigbridge, which is itself low-activity and lags Twig major versions. Before any code is written, the TPM decision is not "how do we install this bundle" but "do we want Twig in this application at all." If the answer is no — the correct default — this package is out of scope and its functionality should be expressed as Blade directives or a small helper/service class. If the answer is yes, this bundle still does not fit, because TwigBridge expects plain Twig extensions, not Symfony bundles.

Recommended migration path (extract, don't integrate):

  1. Inventory — enumerate every filter, function, and test provided by the bundle. This is the actual scope; the bundle wrapper is disposable.
  2. Vendor or reimplement — copy the extension classes into app/Support/Twig/ (or rewrite as Blade directives), strip namespace and DI references, and conform to Twig's AbstractExtension API.
  3. Register explicitly — bind the extensions in an AppServiceProvider and pass them to the Twig environment, or register Blade directives via Blade::directive().
  4. Golden-test — construct fixture-based tests asserting output parity against the original behavior for representative inputs, with explicit attention to locale, timezone, and multibyte strings.
  5. Retire the dependency — do not leave the Composer requirement in place; owning copied code with attribution is cheaper than owning a dead dependency.

Compatibility. Assume breakage at three seams: PHP version (5.x-era signatures vs. 8.x strictness), Twig major version (1.x/2.x class names and getName() vs. Twig 3's AbstractExtension), and Symfony component versions if any are transitively required. Verify each seam with a throwaway composer require in an isolated branch before committing to a path — that spike is half a day and settles the question definitively.

Sequencing. Decision spike (composer resolve + class inspection) → Twig-in-Laravel go/no-go → extract/port → golden tests → ship. Front-load the spike; it is the cheapest point at which to kill the initiative.

Operational Impact

Maintenance — you will own this code regardless of the decision. With zero dependents and zero stars, there is no upstream to absorb PHP/Twig upgrades, no security response process, and no issue triage. If the filters ship, budget recurring time for every PHP minor and Twig major upgrade. The extract-and-own path makes this explicit and bounded (a few hundred lines you control); the bundle-integration path makes it implicit and entangled with a DI shim nobody understands.

Support. No community, no documentation beyond the README, no Stack Overflow corpus. Internal documentation of each ported filter's semantics is mandatory, because the original behavior is only discoverable by reading source. Assign a named owner; unowned ported utility code rots quickly.

Scaling. A non-issue. Twig extensions are compile-time registrations against a cached template graph; runtime cost is identical to any other filter. No memory, connection-pool, or concurrency concerns. Do not let this dimension influence the decision.

Failure modes to design against:

  • Fatal on upgrade — PHP 8 deprecations becoming errors, or Twig 3 removing the registration API. Mitigation: golden tests that run in CI on every dependency bump.
  • Silent behavioral drift — date/timezone filters returning subtly different values after a locale or ICU update, with no upstream changelog to warn you. Mitigation: pin and test edge cases explicitly.
  • Integration abandonment — TwigBridge falls further behind Twig, stranding the rendering layer. Mitigation: treat Twig-in-Laravel as a reversible decision with a documented exit to Blade.
  • Phantom dependency — the bundle remains in composer.json after extraction, blocking future PHP upgrades. Mitigation: remove it in the same PR that ports the code.

Ramp-up. The code volume is small and the concepts (Twig extension registration, Blade directives) are familiar to any mid-level Laravel engineer — roughly one sprint-week including tests and documentation. The ramp-up cost is not learning the package; it is unlearning the assumption that a Symfony bundle can be installed into Laravel. Set that expectation before work begins.

Recommendation. Do not adopt the bundle as a dependency. Evaluate the underlying filters as a source to be extracted, and only if Twig is already (or is deliberately being) introduced into the stack. The expected value of the integration path is negative: high uncertainty, no upstream support, and a small amount of portable logic that is cheaper to own outright.

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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core