Skip to content

bingo-soft/phpdocxtemplate

Repository files navigation

Latest Stable Version Build Status Minimum PHP Version License: MIT Scrutinizer Code Quality Code Coverage

PhpDocxTemplate

PhpDocxTemplate is a PHP library, which uses docx files as Twig templates

Installation

Install PhpDocxTemplate, using Composer:

composer require bingo-soft/phpdocxtemplate

Basic example

use PhpDocxTemplate\PhpDocxTemplate;

$doc = "./templates/template1.docx";
$template = new PhpDocxTemplate($doc);
$template->render(["one" => "1", "two" => "2", "three" => "3", "four" => "4"]);
$template->save("./documents/report.docx");

Acknowledgements

PhpDocxTemplate draws inspiration from python-docx-template and PhpWord libraries.

License

MIT