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 Bridge

Twig Bridge Laravel Package

symfony/twig-bridge

Twig Bridge integrates the Twig template engine with Symfony components, letting you render Twig templates within Symfony apps and use framework features like forms, translations, and routing directly in your templates.

View on GitHub
Deep Wiki
Context7

Provides integration for Twig with various Symfony components

Frequently asked questions about Twig Bridge
Is symfony/twig-bridge a Laravel package?
No. It is a read-only subtree split of the symfony/symfony monorepo that wires the Twig engine into Symfony's Form, HttpKernel, Translation, Mime, Validator, and Asset components. Laravel's rendering layer is Blade, and laravel/framework deliberately does not depend on Twig or symfony/form. Installing it in a Laravel app imports a parallel view, forms, and mail stack rather than adding a single feature, so treat it as an architectural decision, not a drop-in package.
How do I install symfony/twig-bridge in a Laravel application?
Install it with Composer alongside twig/twig, and expect to pull in symfony/form, symfony/translation, symfony/mime, symfony/validator, and symfony/http-foundation for the useful slices. There is no service provider, config file, or facade registered for Laravel, so you must wire any Twig environment yourself. Budget time for Composer resolution: a broad Laravel dependency graph is exactly where conflicts such as the phpdocumentor/reflection-docblock >= 6 clash surface.
Can I replace Blade with Twig in Laravel using this package?
Not practically. This bridge is built against Symfony's templating and HttpKernel abstractions and provides none of the Laravel-specific helpers developers expect, such as Blade-style directives, facades, asset(), csrf_field(), or @csrf. Adopting it means running two view engines, two translation catalogues, and two validation stacks in one codebase. If Twig syntax is the real requirement, a Laravel-native Twig adapter is the realistic route.
Which PHP, Symfony, and Laravel versions does symfony/twig-bridge support?
Support is defined by Symfony release branches, not by Laravel versions: 6.4, 7.4 LTS, 8.0, and 8.1 are maintained in parallel, each with its own PHP floor. There is no documented Laravel compatibility matrix at all, so you must confirm the branch's PHP requirement matches your runtime yourself. For stability pick 7.4 LTS; choose 8.1 only if you specifically need newer Form theme layouts such as daisyUI.
What does symfony/twig-bridge actually provide to templates?
It supplies Twig extensions that expose Symfony features inside templates: form rendering and Form themes, translation and routing helpers, Mime and Mailer integration, Validator helpers, and Asset handling. The most mature and hardest-to-replicate slice is the Form theme layer, which ships Bootstrap 4 and 5, Foundation, and a newer daisyUI layout. Scope any proof of concept to exactly one slice rather than to generic Twig support.
Which Twig versions does symfony/twig-bridge require?
Current branches require twig/twig with a 3.25 minimum floor, driven by EscaperRuntime, and Twig 4 is now explicitly allowed. That means the bridge's release notes effectively dictate your Twig version, which in turn constrains the rest of your application. If you also run other Twig-dependent packages, verify their Twig constraints before upgrading.
Is symfony/twig-bridge safe for production use?
Security is actively managed, but the surface is real and rendering-related code has been exploitable. CVE-2026-45072, an XSS issue in CodeExtension::fileExcerpt(), was patched simultaneously across 6.4.40, 7.4.12, 8.0.12, and 8.1.0-BETA3, which shows a functioning coordinated disclosure process. Adopting it means subscribing to Symfony security advisories and documenting a patch SLA, because fixes ship on Symfony's schedule, not Laravel's.
Does symfony/twig-bridge affect queued mail and job serialization in Laravel?
It can. Recent releases hardened TemplatedEmail::__unserialize() to reject __toString trampolines, and because Laravel serializes queued mailables and jobs, any path that routes Twig-templated mail through a queue intersects that code. This is a genuine behavioural-change risk rather than a theoretical one. Test queued mail against the current hardening before relying on it in production.
Should I use a Laravel-native Twig adapter instead of symfony/twig-bridge?
For a standard Blade or Inertia application, yes, or simply stay on Blade. Laravel-native Twig adapters supply the Laravel-specific extensions this bridge lacks, including directives, facades, asset(), and csrf_field(), without dragging in symfony/form and symfony/validator. Choose symfony/twig-bridge only when you specifically need its Symfony Form theme layer or a Symfony-compatible TemplatedEmail path.
How should I prototype symfony/twig-bridge in a Laravel project, and where do I get support?
Build a throwaway proof of concept scoped to one capability, such as rendering a single Symfony Form theme, and measure the Composer graph and seam ownership before committing. Be aware that issues and pull requests are redirected to symfony/symfony, and the split repo's low dependent count and star numbers are artefacts of the split model, not a signal of low adoption. There is no Laravel-specific documentation or community answer base, so plan for internal expertise. If form rendering is the only driver, compare three-year cost against a Blade component library over Bootstrap or daisyUI before adopting.
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.
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
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections