PHPackages                             nguyenhiep/docxfindandreplace - 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. nguyenhiep/docxfindandreplace

ActiveLibrary

nguyenhiep/docxfindandreplace
=============================

Find and replace variables in a DOCX template.

2.0.0(5y ago)0105MITPHP

Since Sep 20Pushed 5y agoCompare

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

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

DOCX Find &amp; Replace
=======================

[](#docx-find--replace)

This is a simple find and replace utility for DOCX files. Simple way to take a DOCX template, map some variables, and save a new copy.

Installation
------------

[](#installation)

Via Composer

```
$ composer require nguyenhiep/docxfindandreplace
```

Usage
-----

[](#usage)

In your DOCX template you will need to wrap any variables you would like to replace with curly braces (e.g. `firstname`). You can use regex expressions as key

```
\Nguyenhiep\DocxFindAndReplace\Docx::create(__DIR__ . "/template.docx")->replace(
    [
        "firstname"                                         => "nguyen",
        "lastname"                                          => "hiep",
        "/[-0-9a-zA-Z.+_]+@[-0-9a-zA-Z.+_]+.[a-zA-Z]{2,4}/" => "nguyenhiepvan.bka@gmail.com"
    ]
)->save(__DIR__ . '/newfile.docx');
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 63.6% 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 ~1552 days

Total

2

Last Release

1965d ago

Major Versions

1.0.0 → 2.0.02020-12-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ee7ece29e66e7029d6b12d947a7d9714ae36346f21e92d767cfc797b86949d8?d=identicon)[nguyenhiepvan](/maintainers/nguyenhiepvan)

---

Top Contributors

[![nguyenhiepvan](https://avatars.githubusercontent.com/u/33170716?v=4)](https://github.com/nguyenhiepvan "nguyenhiepvan (7 commits)")[![joecampo](https://avatars.githubusercontent.com/u/3619398?v=4)](https://github.com/joecampo "joecampo (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nguyenhiep-docxfindandreplace/health.svg)

```
[![Health](https://phpackages.com/badges/nguyenhiep-docxfindandreplace/health.svg)](https://phpackages.com/packages/nguyenhiep-docxfindandreplace)
```

PHPackages © 2026

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