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

ActiveLibrary[Templating &amp; Views](/categories/templating)

silverslice/docx-template
=========================

Replace variables in docx document

v0.3.3(1y ago)75.0k↓50%5MITPHPPHP &gt;=5.5

Since Aug 28Pushed 1y ago4 watchersCompare

[ Source](https://github.com/silverslice/docx-template)[ Packagist](https://packagist.org/packages/silverslice/docx-template)[ RSS](/packages/silverslice-docx-template/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

Easy tool for replacing variables in docx documents
===================================================

[](#easy-tool-for-replacing-variables-in-docx-documents)

Install
-------

[](#install)

`composer require silverslice/docx-template`

Usage
-----

[](#usage)

Place variables in your docx-document as {foo}. Then replace them with `replace` method. Use `replaceMultiline` to replace variables with multiline strings.

```
use Silverslice\DocxTemplate\Template;

require __DIR__ . '/vendor/autoload.php';

$template = new Template();

// open docx file
$template->open('test.docx')

    // replace one variable to another
    ->replace('one', 'two')

    // replace once more
    ->replace('foo', 'bar')

    // replace with multiline string
    ->replaceMultiline('foo', 'one
        two
        three')

    // save docx document
    ->save('test.docx');
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

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.

###  Release Activity

Cadence

Every ~650 days

Recently: every ~798 days

Total

6

Last Release

664d ago

PHP version history (2 changes)v0.1.0PHP &gt;=5.4

v0.3.1PHP &gt;=5.5

### Community

Maintainers

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

---

Top Contributors

[![silverslice](https://avatars.githubusercontent.com/u/6722542?v=4)](https://github.com/silverslice "silverslice (8 commits)")

---

Tags

templatedocx

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/silverslice-docx-template/health.svg)

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

###  Alternatives

[phpoffice/phpword

PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)

7.5k34.7M186](/packages/phpoffice-phpword)[anourvalar/office

Generate documents from existing Excel &amp; Word templates | Export tables to Excel (Grids)

24085.2k](/packages/anourvalar-office)[shadz3rg/php-stamp

The XSL-way templating library for MS Office Word DOCX documents.

166147.9k](/packages/shadz3rg-php-stamp)[icircle/docx-template-in-php

Create Templates in MS Word docx format and use them Creating Business documents using PHP

4422.7k](/packages/icircle-docx-template-in-php)[wrklst/docxmustache

docx template manipulation class, based on mustache templating language

578.1k](/packages/wrklst-docxmustache)[tyz910/docx-templates

Simple template engine for .docx

2036.2k](/packages/tyz910-docx-templates)

PHPackages © 2026

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