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 Spreadsheet Bundle

Twig Spreadsheet Bundle Laravel Package

mewesk/twig-spreadsheet-bundle

A Symfony bundle that brings Twig templating to spreadsheet generation, letting you design XLSX, CSV, and other spreadsheet files with familiar Twig syntax instead of low-level APIs. Build clean, reusable templates for reports and exports, keep layout logic separate from PHP code, and render dynamic...

View on GitHub
Deep Wiki
Context7

Twig Spreadsheet Bundle brings Twig templating to spreadsheet generation in Symfony applications. Define workbook layouts in familiar Twig templates and render them to Excel-compatible files, keeping export presentation separate from application logic.

  • Render spreadsheets from reusable Twig templates
  • Seamless Symfony bundle integration
  • Built on PhpSpreadsheet for reliable file generation
  • Supports styles, formulas, and cell formatting
  • Clean separation between data and layout
Frequently asked questions about Twig Spreadsheet Bundle
Is mewesk/twig-spreadsheet-bundle a Laravel package?
No. It is a Symfony bundle that registers a DI extension, a spreadsheet service, and a Twig extension exposing PhpSpreadsheet primitives as Twig functions and filters. Laravel has no bundle kernel or compiler pass hooks, and Twig is not its default view engine, so none of that wiring carries over. Treat it as a reference design rather than a drop-in dependency.
Can I install twig-spreadsheet-bundle in Laravel 10 or 11?
Not cleanly. The 2018 release line targets PHP 7.x, Symfony 3.4/4.x, Twig 1/2 and PhpSpreadsheet ^1.0, while Laravel 10/11 runs PHP 8.2/8.3 with PhpSpreadsheet ^2/^3/^4. A composer require will typically fail dependency resolution or need --ignore-platform-reqs, which leaves you on an unsupported runtime combination. Rewiring the bundle through a Laravel service provider is possible but high effort.
How do you generate a spreadsheet from a Twig template with this bundle?
You register the bundle, then use the Twig extension's functions and filters to declare sheets, cells, styles and a writer inside a .twig template, and pass the result to a response factory for download. Layout lives in the template while data arrives as context, which keeps presentation separate from PHP logic. That separation is the genuinely useful idea, even though the integration itself is Symfony-shaped.
Is TwigSpreadsheetBundle still maintained?
No. The repository is archived, the last release dates to 2018-07-29, and it has roughly 22 stars and no dependents. There is no security-response path and no PHP 8.3 compatibility guarantees. For code that reads and writes .xlsx files, abandonment is an operational risk rather than a cosmetic one.
What Laravel alternatives should I use instead of TwigSpreadsheetBundle?
maatwebsite/excel is the actively maintained, Blade-friendly option and covers most export needs. If you specifically want template-authored layouts, a PhpSpreadsheet service class driven by a Blade partial or an array-based layout spec gets you the same layout/logic separation. The practical recommendation is to reimplement the pattern natively and keep the bundle only as a design reference.
Which PhpSpreadsheet version does TwigSpreadsheetBundle support?
The bundle pins early PhpSpreadsheet ^1.0, matching its 2018 release window. Modern Laravel projects run PhpSpreadsheet ^2, ^3 or ^4, and the writer and response APIs changed materially across those majors. Upgrading inside the bundle means re-targeting that API surface, not just bumping a version constraint.
Is it safe to generate .xlsx files with an abandoned package?
Risky. Spreadsheet handling sits on XML and zip parsing with a real CVE history, including external entity handling and formula injection in generated files. Pin-and-freeze does not mitigate parser vulnerabilities, and an archived repo gives you nowhere to report or receive fixes. For customer- or regulator-facing artifacts, the default answer should be no.
How do I test that new spreadsheet output matches the old Twig templates?
Capture current outputs as golden-file fixtures and compare cell by cell, because byte comparison of .xlsx is fragile due to embedded timestamps and metadata. That harness is the acceptance gate for any migration, whether you fork the bundle or rebuild the exporter. Do a capability inventory first, since real usage is usually far narrower than the bundle's full API surface.
Can I run Twig inside Laravel with twigbridge to reuse this bundle?
You can add rcrowe/twigbridge so Twig exists in Laravel, then reimplement the bundle's service definitions as a service provider and re-register the Twig extension. It works as a migration crutch but leaves you maintaining a second view engine plus a forked, abandoned dependency. Most teams find a native Blade or array-spec exporter cheaper within a year or two.
Does TwigSpreadsheetBundle handle multiple sheets, styling and formulas?
Yes. The Twig extension exposes spreadsheet primitives for sheets, cells, styles, merged cells, column sizing, writers and HTTP responses, so multi-sheet workbooks with formulas are achievable from a template. Whether your project actually uses all of that is a separate question, and it is exactly what a capability inventory should establish before you commit to a migration path.
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.
mmccook/php-json-canonicalization-scheme
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
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent