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 Extensions Bundle Laravel Package

mapado/twig-extensions-bundle

A Symfony bundle that bundles useful Twig extensions from the Mapado Twig Extensions library into your application, adding handy filters and functions to templates with minimal setup and configuration.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit — mismatch against the stated stack. The package is a Symfony bundle, not a Laravel package. Its entry point is a Bundle subclass registered in the kernel and wired through Symfony's DependencyInjection container; Laravel has no equivalent concept, so the bundle wrapper cannot be booted natively. The only genuinely portable artifact is the underlying Twig extension class implementing Twig\Extension\ExtensionInterface, which is framework-agnostic and can be registered in any Twig environment. The practical consequence for a TPM: the "package" as shipped is ~90% Symfony plumbing and ~10% functional code, and that functional code is a thin wrapper over PHP's native parse_url().

Functional scope. Effectively a single Twig filter/function exposing parse_url — URL decomposition (scheme, host, path, query, fragment) inside templates. There is no broader toolkit. The description ("parse_url for now") is accurate and the entire extension is readable in minutes.

Integration feasibility — feasible but disproportionate. Absolute engineering effort is low (extract one class or reimplement in ~15–20 lines). But adopting it as a dependency in a Blade-first Laravel app would require standing up a third-party Twig bridge — a large architectural commitment justified only for one filter. In a Laravel app that already runs Twig (e.g. via rcrowe/twigbridge), the extension class can be registered directly through the bridge's extension list, bypassing the bundle entirely.

Technical risk — high for a trivial payload.

  • License: NOASSERTION. No confirmed SPDX identifier means no verified grant of rights. This is a legal-review blocker in most organizations and is disproportionate to a parse_url wrapper.
  • Abandonment. 0 stars, 0 dependents, no visible release cadence or issue triage. Treat upstream as frozen at day one.
  • Version drift. Twig 1/2/3 have incompatible extension signatures (getName() removal, base-class changes). Compatibility is unverified from available metadata.
  • Supply-chain exposure. A Composer dependency with unclear licensing and no dependents adds audit surface with no compensating value.

Key questions for the team.

  1. Does this Laravel application actually run Twig, or is that hypothetical? (If Blade-only, close the ticket.)
  2. Has legal cleared a NOASSERTION-licensed dependency, or can we fork under our own license header?
  3. Which Twig major version does the extension target, and does our environment match?
  4. Is parse_url-in-templates worth a dependency when a small custom Twig extension — or a Blade directive / view composer — delivers the same result with zero external risk?

Integration Approach

Stack fit. Laravel + Blade (the default): no fit — do not adopt. Laravel + an existing Twig bridge: conditional fit, and even then register the extension class directly rather than attempting to boot the Symfony bundle.

Recommended path — treat the repo as reference source, not a dependency. Two viable options:

  1. Vendor-extract — copy the extension class into app/Twig/Extensions/ParseUrlExtension.php under our namespace and license header. Preserves behavior, removes the unlicensed dependency and the bundle wrapper.
  2. Reimplement — write the extension natively against parse_url(). The functional delta versus extraction is negligible and this is the lower-risk default.

Compatibility checks before any code lands. Inspect the package composer.json for PHP, Twig, and Symfony constraints. Confirm whether the extension registers as a filter, a function, or both so template call sites are preserved on reimplementation. Verify behavior on the parse_url() edge cases we care about — malformed input returns false, and relative URLs return no host.

Sequencing.

  1. Gate: confirm Twig is present in the target Laravel app. If Blade-only, close the ticket.
  2. Run a legal review of the NOASSERTION license in parallel — non-blocking if we choose reimplementation.
  3. Spike: install into a throwaway sandbox, read the extension source, document exact filter/function names, argument order, and return behavior (including false/null handling on malformed input).
  4. Extract or reimplement under app/Twig/Extensions/ with our own license header.
  5. Register via the Twig bridge config or a ServiceProvider; add a unit test covering valid URL, relative URL, and malformed input.
  6. Delete the sandbox dependency. Do not ship mapado/twig-extensions-bundle to production.

Where this capability belongs. For anything beyond presentation — building redirects, comparing URLs, deduplicating sitemap entries, parsing query strings into key/value maps — do the parsing in a service or controller and hand the template a prepared value. Templates are the wrong place to branch on URL structure. Templates should consume a ready-made value ($urlParts, $host) rather than embed parse_url semantics.

Operational Impact

Maintenance. Effectively zero upstream maintenance — the team inherits full ownership immediately. If we vendor-extract, we own Twig-major upgrade work on code we did not write; reimplementing collapses that to our own code under our own upgrade cadence. Either way, budget a small recurring cost for Twig signature changes and treat it as part of the internal Twig helpers surface.

Support. No community, no dependents, no maintainer responsiveness signal. There is no escalation path for a defect — we are the maintainers. This is tolerable only because the code is trivially auditable, which is precisely why extract/reimplement is preferred over dependency.

Scaling. Negligible. parse_url is a native PHP call with no I/O and no allocation pressure; rendering overhead is bounded by template usage frequency, not by the extension. No infrastructure implications, no caching considerations.

Failure modes to instrument.

  • Silent template breakage on Twig version bump — extension signature changes surface as a fatal at render, not at boot. Catch with a smoke test that renders a fixture template.
  • Malformed-URL behavior — parse_url returns false on severely malformed input; the extension's handling must be verified so templates degrade gracefully rather than emitting warnings.
  • Accidental bundle registration — if a developer introduces the Symfony-compat shim, container compile failures will be opaque. Prevent by not declaring the dependency at all.
  • License audit finding — NOASSERTION surfacing in a post-deployment SBOM/SCA scan; eliminated entirely by the extract-or-reimplement path.
  • Query-string misuse — parse_url() returns query as a raw string. Teams expecting a key/value map will hand-roll string splitting in Twig, which is fragile. Document that a separate helper is required.

Ramp-up. Technical ramp is near-zero — an engineer can read the entire package in minutes. Process overhead (legal, security, SCA review) dominates and is disproportionate to the value delivered. TPM recommendation: do not adopt as a dependency. Extract or reimplement the single parse_url extension into the internal Twig helpers surface, and revisit only if upstream matures to a clear license, a tagged release cadence, and confirmed Twig 3 support.

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.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route