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
Document Templates

Document Templates Laravel Package

42coders/document-templates

42coders/document-templates is a Laravel package for creating reusable document templates with dynamic placeholders. Map model or array data into template variables and render personalized invoices, contracts, and reports, simplifying data-driven document generation and export workflows in your appl...

View on GitHub
Deep Wiki
Context7

Laravel package for creating and managing user editable document templates with placeholders and various data sources.

Frequently asked questions about Document Templates
What is 42coders/document-templates used for in Laravel?
42coders/document-templates is a Laravel package for creating and managing user-editable document templates with dynamic placeholders. It maps Eloquent model or array data into template variables so you can render personalized invoices, contracts, quotes, reports, and similar documents. It fits Laravel monoliths or modular monoliths where business users need to change document wording without a developer editing Blade templates.
How do I install 42coders/document-templates?
Install it with Composer using composer require 42coders/document-templates, then publish the package config, migrations, and assets. Run php artisan migrate to create the document_templates table. Add the provided trait to the Eloquent models that own templates, and configure which data sources feed each placeholder. Check the README for the exact publish tags and editor asset steps for your package version.
Which Laravel and PHP versions does 42coders/document-templates support?
The package is built for Laravel applications and includes a service provider, publishable config, and migrations. The supplied context does not pin specific Laravel or PHP version constraints, so verify the composer.json requirements and release history against your current Laravel and PHP versions before adopting. Also check the separate JavaScript editor package's release cadence, because the PHP and front-end sides can drift.
How do placeholders and data sources work in 42coders/document-templates?
Placeholders are template variables resolved by a placeholder-resolution layer that maps them to application data sources. You can feed data from Eloquent models through the provided trait and relationship or from arrays, depending on how you configure the data-source contract. Treat placeholder resolution as a stable internal API and define typed, scoped data sources rather than spreading ad hoc resolution logic across templates.
Does 42coders/document-templates generate PDF or DOCX files?
The package focuses on template management and placeholder rendering; it does not by itself guarantee DOCX or PDF output. Producing DOCX or PDF from an HTML-style template typically requires an additional PHP library or an external converter such as LibreOffice headless or Gotenberg. Confirm the conversion path and test fidelity on your hardest real documents, especially tables, headers, footers, and page numbering.
Is the document template editor included, or do I need npm and Vite?
The architecture separates the Laravel backend from a JavaScript editor package that provides the authoring surface. Depending on the release, you may publish prebuilt assets or add the editor as an npm dependency and wire it through Vite or Mix. That is a gating question, so verify the asset path, build-tool compatibility, and CSP requirements before committing.
Can I use 42coders/document-templates with multi-tenant or permission-scoped data?
Placeholder resolution is where your domain model meets the template format, so scoping matters. The package provides a resolution layer, but the available context does not confirm built-in per-tenant or per-role typed data sources. Plan to enforce tenant and role scoping in your own data-source definitions and test that templates cannot resolve data the author is not allowed to see.
Is 42coders/document-templates safe for user-editable templates?
User-editable templates are an XSS surface if previews are rendered as HTML, and a template-injection surface if placeholder syntax is evaluated rather than string-replaced. Confirm the package's resolution model before exposing the editor to non-technical users. Sanitize previews, restrict who can publish templates, and validate resolved output in your application layer.
Does 42coders/document-templates provide template versioning and audit trails?
The available context does not indicate that the package provides built-in template versioning, data snapshots, or output provenance. For legal, HR, or financial documents, assume you must add version tracking and an audit record of which template version, data set, and output were used. Check the schema and package code before relying on it for regulated workflows.
How should I test document rendering with 42coders/document-templates in Laravel?
Test template rendering at the resolution boundary by feeding known model or array data into placeholders and asserting the rendered output, including missing-variable behavior. Add integration tests for the conversion step if you generate PDF or DOCX, and test authorization so templates cannot resolve data outside the owner's tenant or role. Also test editor asset loading and CSP compatibility in your front-end build.
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.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route