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

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

Some cool Twig extensions (parse_url for now)

Frequently asked questions about Twig Extensions Bundle
Does mapado/twig-extensions-bundle work with Laravel out of the box?
No. It is a Symfony bundle whose entry point is a Bundle subclass registered in the Symfony kernel and wired through Symfony's DependencyInjection container, and Laravel has no equivalent concept, so the bundle cannot be booted natively in a Laravel app. Only the underlying Twig extension class is framework-agnostic and potentially reusable.
How do I install mapado/twig-extensions-bundle in a Laravel project?
You can run composer require mapado/twig-extensions-bundle, but installation alone does not make it usable in Laravel because there is no service provider or bundle boot process that Laravel recognizes. To get any value you would need an existing Twig bridge such as rcrowe/twigbridge and then register the extension class directly, bypassing the Symfony bundle wrapper. For Blade-only apps, installation adds a dependency with no functional benefit.
What filters and functions does this Twig extensions bundle actually provide?
The functional payload is effectively a single Twig filter or function that exposes PHP's native parse_url(), letting templates decompose a URL into scheme, host, path, query, and fragment. There is no broader toolkit of filters, functions, or tests despite the bundle framing. The entire extension is small enough to read in a few minutes.
Can I use mapado/twig-extensions-bundle with Blade templates?
No. The package ships Twig extensions, and Blade is a separate templating engine that does not consume Twig extensions. In a Blade-first Laravel application you would instead write a small Blade directive or view composer that calls parse_url(), which delivers the same result with no external dependency.
Which Laravel and Twig versions does mapado/twig-extensions-bundle support?
There is no Laravel version support to speak of because the package is Symfony-oriented and does not declare Laravel framework constraints. Twig 1, 2, and 3 have incompatible extension signatures, including removal of getName() and base-class changes, and compatibility is unverified from the available metadata. Inspect the package composer.json for PHP, Twig, and Symfony constraints before relying on it.
Is mapado/twig-extensions-bundle maintained and safe for production?
Treat upstream as frozen: the project shows 0 stars, 0 dependents, and no visible release cadence or issue triage. Adopting it in production adds supply-chain audit surface for a very small payload. The lower-risk default is to extract or reimplement the extension in your own codebase.
What license does mapado/twig-extensions-bundle use, and can I use it commercially?
The repository reports NOASSERTION, meaning there is no confirmed SPDX identifier and therefore no verified grant of rights. In most organizations that is a legal-review blocker, especially for a dependency that only wraps parse_url(). If you need the behavior, forking the extension under your own license header after review, or reimplementing it, avoids the ambiguity.
How do I register the parse_url Twig extension without booting the Symfony bundle?
In an environment that already runs Twig, for example a Laravel app using rcrowe/twigbridge, you can register the extension class directly through the bridge's extension list instead of registering the Symfony bundle. Alternatively, copy the extension into your own namespace such as app/Twig/Extensions/ParseUrlExtension.php and add your license header. Either path preserves template call sites while removing the unlicensed dependency and the bundle plumbing.
Is there a better Laravel alternative to this package for URL parsing in templates?
For Blade apps, a small custom directive or view composer around parse_url() is simpler and carries zero third-party risk. For Twig-based Laravel apps, a short custom Twig extension written against parse_url() is functionally equivalent to this package's entire payload. Reimplementation is the recommended default because the functional delta versus vendor extraction is negligible.
How should I test the parse_url Twig filter if I reimplement it in Laravel?
Write unit tests against the extension or directive using PHPUnit, covering the edge cases that matter: malformed input where parse_url() returns false, and relative URLs where no host component is returned. Then add a template-level test that renders a URL string through the filter and asserts the decomposed parts. This is faster than installing the Symfony bundle into a sandbox just to observe behavior.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo