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 Bundle

Twig Bundle Laravel Package

lendable/twig-bundle

A Twig templating bundle for Laravel that renders .twig views alongside Blade, configures template paths, registers custom extensions, and caches compiled templates. It keeps Laravel’s view workflow while offering Twig’s concise syntax, ideal for teams migrating from Symfony or preferring a flexible...

View on GitHub
Deep Wiki
Context7

load twig templates from the database

Frequently asked questions about Twig Bundle
Is lendable/twig-bundle a Laravel package?
No. Despite being catalogued as a Laravel/PHP package, lendable/twig-bundle is a Symfony bundle. It ships a Symfony Bundle subclass, a dependency-injection extension, Doctrine entity and mapping assumptions, and container service wiring. There is no Laravel service provider and nothing for Composer to auto-register in a Laravel app. Treat it as Symfony code or as a reference implementation, not a Laravel dependency.
How do I install lendable/twig-bundle in a Laravel application?
You cannot meaningfully install it as a Laravel package. Running composer require would not register a Laravel service provider, and the bundle expects a Symfony kernel and container. For Twig in Laravel you need a Laravel-side bridge such as rcrowe/twigbridge, which builds its own Twig environment and does not consume Symfony bundles. If you want this bundle's database-loader pattern, plan to fork and port it.
Which Laravel versions does lendable/twig-bundle support?
None officially. The package has no Laravel service provider, no Laravel version constraints, and no Blade or view-finder integration. Its supported matrix is Symfony, Twig, Doctrine, and PHP, and even that needs verification against your composer.json pins. For Laravel Twig support, check the Laravel compatibility of a bridge like TwigBridge instead.
Can I render .twig views alongside Blade in Laravel?
Yes, but not with this package. In Laravel you would use rcrowe/twigbridge to register Twig as an additional view engine while Blade continues to work normally. This bundle does not hook into Laravel's view finder or view factory, so it cannot render .twig views in a Laravel app by itself. It is a Symfony integration layer.
How do I configure Twig template paths in Laravel?
In Laravel, template paths are configured through TwigBridge's config/twigbridge.php file and its extension settings. This bundle exposes its paths through Symfony dependency-injection configuration, which Laravel does not read. If you port the pattern, map its template paths onto Laravel view paths or a custom Twig loader. Do not expect the bundle's configuration keys to work in Laravel.
How do I register custom Twig extensions, filters, functions, and globals?
In Symfony, this bundle lets you register custom Twig extensions, filters, functions, and globals through familiar service configuration and container tags. In Laravel with TwigBridge, you register extensions through the TwigBridge configuration instead. The bundle's extension mechanism is container-based and is not consumed by Laravel. A port would need to re-register those extensions in the Laravel-side Twig environment.
Does lendable/twig-bundle cache compiled Twig templates?
Twig itself supports compiled-template caching, and this bundle exposes cache configuration for the Symfony environment. In a Laravel setup you would configure the cache path on the Twig environment created by your bridge. If you use its database-loader pattern, pay close attention to isFresh semantics: naive implementations either hit the database on every render or silently serve stale templates after an edit. Both outcomes undermine trust in runtime-editable templates.
Is it safe to store Twig templates in the database?
Not by default. Database-stored templates are runtime-evaluable code, and Twig is not sandboxed out of the box. Anyone who can write a row, or exploit an admin-panel bug, could potentially invoke exposed PHP functions. If you adopt this pattern, plan for the Twig sandbox extension, strict capability checks, audit trails, and careful access control before going to production.
What are the alternatives for using Twig in Laravel?
The main alternative is rcrowe/twigbridge, which integrates Twig with Laravel's view layer while keeping Blade available. You can also wire Twig directly through a custom view engine if you need tighter control. Lendable TwigBundle is not an alternative for Laravel because it is Symfony-only. It is more useful as a reference for database-backed Twig loaders if you decide to build that capability yourself.
Is lendable/twig-bundle maintained and production-ready?
There is no evidence of production use: the project has zero stars, zero dependents, and no visible community or issue triage. Treat it as sample code under a permissive license rather than a dependable dependency. Before reusing anything, verify the license, last commit date, tagged Packagist releases, and CI status. If you do reuse code, fork and pin it so a repository or Packagist disappearance cannot break your builds.
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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
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