PHPackages                             archfz/word-template - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. archfz/word-template

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

archfz/word-template
====================

Generate word documents from word templates using PHP.

3188C++

Since Apr 7Pushed 9y ago2 watchersCompare

[ Source](https://github.com/archfz/word-template)[ Packagist](https://packagist.org/packages/archfz/word-template)[ RSS](/packages/archfz-word-template/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (3)Used By (0)

Word Template
-------------

[](#word-template)

This package provides a binary executable to generate word from templates and a wrapper object *WordTemplate* to use it in PHP. The binary is compiled from c++, which uses the [DocxFactory](http://docxfactory.com/) third party library.

### Requirements

[](#requirements)

The usage relies on a system executable. This means that certain libraries are required.

- **GCC v5+** - by installing gcc you should have most of these libraries available
- **libstdc++ 6.0.21** - in certain cases you might have issues (like on centos); the problem you might have is with this lib which needs to be configured manually ([download](https://drive.google.com/file/d/0B7S255p3kFXNNTIzU2thRlZmYVE/edit))
- **PHP NTS** (Non-Thread-Safe) - this is required because for some reason the thread safe is not allowed to execute the binary

### Installation

[](#installation)

```
composer require archfz/word-template:1.3.x-dev

```

**Note:** require with the specified version, otherwise not the 'package' branch will be used. This branch is better as it does not include all the c++ source files and libraries that are not required for functionality.

### Usage

[](#usage)

First you need to create a template word document. This must be **.docx**.

In it you create placeholders with braces like the following: **{placeholder}**.

You can also bookmark things that you select and then these elements will be cloneable. For example bookmark the upper placeholder and name it '**myplaceholder**'.

In case of the above described word template you can do the following:

```
use archfz/Word/WordTemplate

$template = new WordTemplate('test.docx');

$template->paste('myplaceholder');
$template->setValue('placeholder', 'Put one here');

$template->paste('myplaceholder');
$template->setValue('placeholder', 'Put another different');

$template->compile();
```

Which will produce a **test\_compiled.docx** with two lines:

```
Put one here
Put another different

```

### Contribute

[](#contribute)

To better understand or to extend functionality you can [learn more here](http://docxfactory.com/download/128/).

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13706730?v=4)[Fodor Zoltan](/maintainers/archfz)[@archfz](https://github.com/archfz)

---

Top Contributors

[![archfz](https://avatars.githubusercontent.com/u/13706730?v=4)](https://github.com/archfz "archfz (76 commits)")

---

Tags

composerdocxofficephptemplateword

### Embed Badge

![Health badge](/badges/archfz-word-template/health.svg)

```
[![Health](https://phpackages.com/badges/archfz-word-template/health.svg)](https://phpackages.com/packages/archfz-word-template)
```

###  Alternatives

[42coders/document-templates

Document template management package.

19940.0k](/packages/42coders-document-templates)[qipsius/tcpdf-bundle

A bundle to easily integrate TCPDF into Symfony

23749.5k](/packages/qipsius-tcpdf-bundle)[macopedia/magmi2

Magento Mass Importer 'Magmi' for Magento 2

11615.7k](/packages/macopedia-magmi2)[tarfin-labs/easy-pdf

Makes pdf processing easy.

1719.4k](/packages/tarfin-labs-easy-pdf)[akeneo-labs/excel-connector-bundle

Akeneo PIM Excel connector bundle

166.4k](/packages/akeneo-labs-excel-connector-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
