PHPackages                             nowo-tech/word-template-bundle - 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. [Templating &amp; Views](/categories/templating)
4. /
5. nowo-tech/word-template-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

nowo-tech/word-template-bundle
==============================

Symfony bundle: fill .docx Word templates (PHPWord TemplateProcessor) from a context array — scalars, rich HTML, table rows, images.

v1.0.1(3w ago)023MITPHP &gt;=8.2 &lt;8.6

Since May 12Compare

[ Source](https://github.com/nowo-tech/WordTemplateBundle)[ Packagist](https://packagist.org/packages/nowo-tech/word-template-bundle)[ Docs](https://github.com/nowo-tech/WordTemplateBundle)[ RSS](/packages/nowo-tech-word-template-bundle/feed)WikiDiscussions Synced 3w ago

READMEChangelog (6)Dependencies (26)Versions (7)Used By (0)

WordTemplateBundle
==================

[](#wordtemplatebundle)

[![CI](https://github.com/nowo-tech/WordTemplateBundle/actions/workflows/ci.yml/badge.svg)](https://github.com/nowo-tech/WordTemplateBundle/actions/workflows/ci.yml)[![Packagist Version](https://camo.githubusercontent.com/f9ab66258a1b46055f85c48741067b0badcad8a1cf4e3083bd1b3c9643b7c492/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f776f2d746563682f776f72642d74656d706c6174652d62756e646c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/nowo-tech/word-template-bundle)[![Packagist Downloads](https://camo.githubusercontent.com/942bc93ce5c55e67fef420f8e583d30123a600a9c66944dbca266d524b486d14/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f776f2d746563682f776f72642d74656d706c6174652d62756e646c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/nowo-tech/word-template-bundle)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/3f99b197569aa2dcfbefff17ecc68d74098e7f929d8b52dc40f3a898f740eae1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d3737374242343f6c6f676f3d706870)](https://php.net)[![Symfony](https://camo.githubusercontent.com/35e729466e7c04d8e831d5ba45054ae825182b6800a4aa45c2296529d75b5b19/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d362e34253230253743253230372e34253242253230253743253230382e30253230253743253230382e312532422d3030303030303f6c6f676f3d73796d666f6e79)](https://symfony.com)[![GitHub stars](https://camo.githubusercontent.com/1275ebf25cac7a6a7a40785d69af4fcdc28456d9443967d5ea668f717576ff86/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6e6f776f2d746563682f576f726454656d706c61746542756e646c652e7376673f7374796c653d736f6369616c266c6162656c3d53746172)](https://github.com/nowo-tech/WordTemplateBundle)[![Coverage](https://camo.githubusercontent.com/b06db15d9682c452cd37d2f672f1ceba257b4f1c55cd39f9c22b8334acbb2b00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d7e39342532352d677265656e)](#tests-and-coverage)

> **Found this useful?** Install from Packagist (`composer require nowo-tech/word-template-bundle`) and consider starring [WordTemplateBundle on GitHub](https://github.com/nowo-tech/WordTemplateBundle).

Symfony bundle that fills **Microsoft Word `.docx` templates** (PHPWord [`TemplateProcessor`](https://phpoffice.github.io/PHPWord/docs/classes/PhpOffice-PhpWord-TemplateProcessor.html)) using a **PHP context array**:

- **Scalars** (strings, numbers, booleans, null) → `setValue` on placeholders such as `${client_name}` or `${client.city}` when you nest arrays (flattened to dot keys).
- **`TableRows`** → `cloneRow` + per-cell `#1`, `#2`, … replacements for repeating table lines.
- **`HtmlContent`** → rich fragments (paragraphs, bold/italic, tables inside HTML, etc.) via PHPWord `Html::addHtml` embedded as a complex block (lists ``/`` may require extra numbering setup in PHPWord; prefer plain paragraphs or combine with [HtmlToWordBundle](https://github.com/nowo-tech/HtmlToWordBundle) for full HTML pipelines).
- **`ImageSource`** → `setImageValue` with optional width/height.
- **`listVariables()`** → read a template and list unique placeholder names (respects configured delimiters).

This bundle does **not** execute Word VBA macros; “macros” here means **template placeholders** in the `.docx` compatible with PHPWord.

Documentation
-------------

[](#documentation)

- [Installation](docs/INSTALLATION.md)
- [Configuration](docs/CONFIGURATION.md)
- [Usage](docs/USAGE.md)
- [Contributing](docs/CONTRIBUTING.md)
- [Changelog](docs/CHANGELOG.md)
- [Upgrading](docs/UPGRADING.md)
- [Release](docs/RELEASE.md)
- [Security](docs/SECURITY.md)
- [Engram](docs/ENGRAM.md)
- [Spec-driven development](docs/SPEC-DRIVEN-DEVELOPMENT.md)

### Additional documentation

[](#additional-documentation)

- [FrankenPHP / Docker demos](docs/DEMO-FRANKENPHP.md) — `demo/symfony7` and `demo/symfony8` (see [`demo/README.md`](demo/README.md))

Requirements
------------

[](#requirements)

- PHP **8.2+**
- Symfony **6.4 / 7.x / 8.x** (as in `composer.json`)
- Extensions: `dom`, `json`, `libxml`, `zip`

Quick start
-----------

[](#quick-start)

```
composer require nowo-tech/word-template-bundle:^1.0
```

Register `Nowo\WordTemplateBundle\WordTemplateBundle` if needed, then wire your templates and inject `WordTemplateProcessorInterface`:

```
use Nowo\WordTemplateBundle\Processor\WordTemplateProcessorInterface;

$doc = $this->wordTemplateProcessor->process(
    '/path/to/template.docx',
    [
        'title' => 'Contract #42',
        'client' => ['name' => 'ACME', 'city' => 'Madrid'],
    ],
);
$bytes = $doc->readContents();
$doc->dispose(); // if the processor used a temp file
```

Tests and coverage
------------------

[](#tests-and-coverage)

ScopeDetail**PHPUnit**`composer test` — unit + integration (minimal kernel in `tests/Fixtures/AppKernel.php`).**Lines**`composer coverage-check` enforces **≥ 93%** (PCOV). Última medición global: **~94%**.Development
-----------

[](#development)

```
make up
make qa
make release-check
```

### Demos (FrankenPHP)

[](#demos-frankenphp)

From the repository root:

```
cd demo/symfony7 && cp .env.example .env && make up   # Symfony 7, port 8020
cd demo/symfony8 && cp .env.example .env && make up   # Symfony 8, port 8021
```

Or from `demo/`: `make up` / `make up8` (see [`demo/README.md`](demo/README.md)).

Versioning
----------

[](#versioning)

[Semantic Versioning](https://semver.org/).

License
-------

[](#license)

[MIT License](LICENSE).

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance94

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

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.

###  Release Activity

Cadence

Every ~9 days

Total

6

Last Release

25d ago

Major Versions

v0.1.3 → v1.0.02026-06-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/e7947bfc3f2ce9574a18a2c60f3d95b5d1b0740e65dc929332c92f1df21f75ab?d=identicon)[HecFranco](/maintainers/HecFranco)

---

Tags

symfonytemplateworddocxPhpWordSymfony BundleMail-merge

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nowo-tech-word-template-bundle/health.svg)

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

PHPackages © 2026

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