blaspsoft/doxswap
DoxSwap is a Laravel package for working with DOCX templates: fill placeholders with data, generate Word documents, and convert them to PDF. It offers a simple, fluent API for building dynamic documents in PHP applications.
.docx files, legal/HR/compliance can keep editing and versioning documents in Word. That's a product decision in itself: it removes the "we need a template CMS and an admin UI" requirement from the roadmap for v1.Adopt when most of these hold:
PHPWord's TemplateProcessor directly.Look elsewhere when:
docxtemplater (JS, richer templating), PhpWord with explicit control, or a commercial engine. Confirm DoxSwap's actual capabilities against a spike before committing; "flexible data mapping" in the README is not the same as a documented control-flow syntax.To executives: We can ship automated document generation — contracts, offers, invoices, certificates — in a fraction of the time it would take to build. The package is MIT-licensed (no per-document fees, no vendor contract), keeps customer data inside our own infrastructure rather than shipping it to a third-party document API, and lets Legal and HR keep authoring templates in Word so we don't need to build or buy a template management UI. Cost is essentially engineering integration time plus ongoing template maintenance. The main caveat to state plainly: it's a focused utility from a small open-source project, so we'll pin the version, wrap it behind our own internal service interface, and cover it with tests — which caps our downside if we ever need to replace it.
To engineering: It's a Laravel-native wrapper over DOCX placeholder replacement with an expressive API. It removes the OOXML plumbing from the critical path. Recommended adoption pattern: wrap it in a single DocumentGenerator service with our own interface, keep templates in version control as fixtures, and add golden-file regression tests for each template so package upgrades or an eventual swap are low-risk. Explicitly out of scope for v1: PDF conversion, e-signature, and complex conditional/repeating content — those are separate tickets, and if conditional logic turns out to be a hard requirement, we should benchmark it against docxtemplater before locking in.
How can I help you explore Laravel packages today?