PHPackages                             campo/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. campo/docxfindandreplace

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

campo/docxfindandreplace
========================

Find and replace variables in a DOCX template.

1.0.0(9y ago)11381MITPHP

Since Sep 20Pushed 9y ago1 watchersCompare

[ Source](https://github.com/joecampo/docxfindandreplace)[ Packagist](https://packagist.org/packages/campo/docxfindandreplace)[ RSS](/packages/campo-docxfindandreplace/feed)WikiDiscussions master Synced 4w ago

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

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

[](#docx-find--replace)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ea3979d2589f98193298fb972be37f4cc551c28e732d83754b6bf8cabfb4a7a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63616d706f2f646f637866696e64616e647265706c6163652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/campo/docxfindandreplace)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Latest Version on Packagist](https://camo.githubusercontent.com/7fe2ba67d4b84c29139cf3b0db6eeed12080e82dbc3998056a6d6a9f066b360a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63616d706f2f646f637866696e64616e647265706c6163652e737667)](https://packagist.org/packages/campo/docxfindandreplace)[![Build Status](https://camo.githubusercontent.com/ec2b1dd19d25034f550ab5e724d04a5464386ed2dc63da64fd98b723a085387b/68747470733a2f2f6170692e7472617669732d63692e6f72672f6a6f6563616d706f2f646f637866696e64616e647265706c6163652e737667)](https://travis-ci.org/joecampo/docxfindandreplace)

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 campo/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}`. Be sure to use variables in your template that are all **uppercase** as Microsoft Word's spell check will create issues.

```
\Campo\DocxFindAndReplace\Docx::create(__DIR__ . "/template.docx")->replace(
    [
        'FIRSTNAME' => 'Joe',
        'LASTNAME' => 'Campo',
    ]
)->save(__DIR__ . '/newfile.docx');
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Unknown

Total

1

Last Release

3569d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[dbrekelmans/bdi

PHAR distribution of dbrekelmans/browser-driver-installer.

656.3M162](/packages/dbrekelmans-bdi)[kubotak-is/php-del

Tool to remove code based on specific comments.

1648.6k](/packages/kubotak-is-php-del)

PHPackages © 2026

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