docx template manipulation class, based on mustache templating language
wrklst/docxmustache is a Laravel package for docx template manipulation class, based on mustache templating language.
It currently has 57 GitHub stars and 9.179 downloads on Packagist (latest version v0.0.52).
Install it with composer require wrklst/docxmustache.
Discover more Laravel packages by wrklst
or browse all Laravel packages to compare alternatives.
Last updated

Docx template manipulation class for Laravel 12.x, based on mustache templating language. This class is still under heavy development and works more like proof of concept at the moment. Things will change quickly and might break things.

With DocxMustache, you can:
Install the package via Composer:
composer require wrklst/docxmustache
Refer to the Examples section and the examples folder for configuration and usage instructions.
Basic HTML conversion is supported, including:
<b>)<i>)<u>)Limitations:
htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
Special Note: To prevent unnecessary escaping of HTML, prefix the value with:
*[[DONOTESCAPE]]*
Dynamic image replacement is supported. Follow these steps:
[IMG-REPLACE]http://placehold.it/350x150[/IMG-REPLACE]
Note: Images will be resampled to match the constraints of the placeholder image in the template.
To enable DOCX-to-PDF conversion, install libreoffice-common on your server:
sudo apt install libreoffice-common
For Arial font support, install:
sudo apt-get install ttf-mscorefonts-installer
For Intervention Image, ensure you:
gd or imagick as required (details here).If you want to port the package to a non-Laravel environment, consider replacing:
\Symfony\Component\Process\Process for PDF conversion.Check out the examples folder for sample templates and usage.
Contributions are welcome! To contribute:
We’ll be happy to review and discuss your ideas!
While there are existing libraries for DOCX manipulation, they often:
DocxMustache was designed to:
Here are other popular PHP libraries for DOCX manipulation: