alshabalin / docx-template
Docx Template
Installs: 39
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/alshabalin/docx-template
Requires
- php: >=5.4
- ext-zip: *
This package is not auto-updated.
Last update: 2025-10-26 07:20:26 UTC
README
Allows convert any docx document to template, using variable, like {this}.
Install the package
composer require alshabalin/docx-template
How to use
<?php require 'vendor/autoload.php'; use Alshabalin\DocxTemplate\DocxTemplate as DocxTemplate; $data = [ 'key' => 'value', 'name' => 'John', 'lastname' => 'Doe', 'city' => 'London', ]; $template = new DocxTemplate(); $template->open('document.docx') ->setData($data) ->save('result.docx');
You may want to remove any missing variables from your template by passing true as the second param to setData method:
$template->setData($data, true);