twig/extra-bundle
Twig Extra Bundle is a Symfony bundle that automatically enables all Twig extra extensions with no configuration. Install via Composer to add useful filters, functions, and tags to your Twig templates without manual setup.
truncate, markdown rendering, localized number/date/plural formatting, CSS inlining, HTML minification, template-fragment caching) is a small liability. This bundle lets you buy those from the upstream Twig org as one-line installs, so the PM decision is which capabilities to enable, not whether to maintain them.IntlExtension → multilingual UI and locale-aware formatting; MarkdownExtension / MarkdownExtraExtension → user-authored or CMS content; CssInlinerExtension / InkyExtension → transactional email fidelity; CacheExtension → render-cost reduction on expensive partials; HtmlCompressExtension → payload trimming. Treat the bundle as an enabler that makes those feature increments cheap rather than separate build items.Form, Router, CSRF, and AssetMapper. It should not be cited as evidence for introducing Twig into a Laravel codebase; in that context it is at best inert and at worst extra Symfony surface area.Adopt when:
twig/markdown-extra, twig/intl-extra, twig/cache-extra, etc. is the opt-in, with no service registration.Look elsewhere when:
twig-laravel/twig: register only the two or three non-Symfony extensions you actually use (String, Intl/Text, Markdown) in a service provider. Same filters, no Symfony component weight, no auto-configuration that assumes a container you don't have.Form, Url, Csrf, AssetMapper) in a non-Symfony app — those require adapter layers that are fragile across upgrades. Use framework-native equivalents instead.Executives. This is plumbing, not a differentiator. It lowers the marginal cost of a small set of rendering capabilities — locale-aware formatting, markdown content, email-safe HTML, template caching — by making maintained extensions a one-line install. Licensing is MIT, stewardship is the Twig organization, and the escape hatch is trivial: if it disappeared, we'd replace it in about a day. That makes vendor risk low. The critical caveat is scope: its value is realized only if we are already committed to Twig inside a Symfony application. It should not be used as an argument for pulling Twig into our Laravel/Blade surfaces.
Engineering — Symfony surfaces. Install the extras you need, install the bundle, stop. It discovers and registers them; there is no config file to maintain. Pin the minor version, note that 4.x requires PHP 8.2, and treat the bundle as thin configuration rather than an abstraction to build on.
Engineering — Laravel surfaces. Don't add it. If Twig is already decided (e.g., a shared template set inherited from a Symfony system), register the non-Symfony extras manually and keep composer lean. Explicitly flag that extensions expecting Symfony routing, forms, CSRF, or asset mapping will not work without adapters, and don't schedule features against them.
Recommendation. No action for Blade/Livewire workstreams. For any Symfony-side rendering surface, adopt at near-zero cost and revisit only when we take on the PHP 8.2 / 4.x baseline.
How can I help you explore Laravel packages today?