PHPackages                             irebega/docx-replacer - 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. irebega/docx-replacer

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

irebega/docx-replacer
=====================

PHP extension that allow you replace text to text or text to image in DOCX file

v1.1.0(6y ago)1432.1k—10%10[2 issues](https://github.com/igorrebega/docx-replacer/issues)[1 PRs](https://github.com/igorrebega/docx-replacer/pulls)MITPHPPHP &gt;=5.4.0

Since Jan 19Pushed 2y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (1)Versions (8)Used By (0)

PHP .docx replacer
------------------

[](#php-docx-replacer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f9f9e071b61b3b74f53674d7baf893c331d5c927c7d2ffb66864e01a177c7ea1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f697265626567612f646f63782d7265706c616365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/irebega/docx-replacer)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/677146a30c05f1412d6e7c459132159abbd79489a7614ae281e64f55af393957/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f697265626567612f646f63782d7265706c616365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/irebega/docx-replacer)

Extention is no longer supported.
=================================

[](#extention-is-no-longer-supported)

Docx format has so much unconsistency in their xml files and I just can't predict every case. You still can use extension, but on your own risk.

### Replace your variables to text or even to images in .docx files

[](#replace-your-variables-to-text-or-even-to-images-in-docx-files)

### Install

[](#install)

Require this package with composer using the following command:

```
composer require irebega/docx-replacer
```

### Text to text replace

[](#text-to-text-replace)

This code will replace **$search** to **$replace** in **$pathToDocx** file

```
$docx = new \IRebega\DocxReplacer\Docx($pathToDocx);

$docx->replaceText($search, $replace);
```

If you want search to be case insensitive use `replaceTextInsensitive` like:

```
$docx = new \IRebega\DocxReplacer\Docx($pathToDocx);

$docx->replaceTextInsensitive($search, $replace);
```

### Text to image replace

[](#text-to-image-replace)

This code will replace text **$search** to image that are located in **$path** in **$pathToDocx** file

```
$docx = new \IRebega\DocxReplacer\Docx($pathToDocx);

$docx->replaceTextToImage($search, $path);
```

### License

[](#license)

PHP .docx replacer is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 78.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 ~101 days

Recently: every ~131 days

Total

7

Last Release

2435d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/976b7b7ea177ad003f764e6add7af0c0f062970e46381c48cea4d007354c1def?d=identicon)[igorrebega](/maintainers/igorrebega)

---

Top Contributors

[![igorrebega](https://avatars.githubusercontent.com/u/2010915?v=4)](https://github.com/igorrebega "igorrebega (11 commits)")[![joaodos3v](https://avatars.githubusercontent.com/u/28982977?v=4)](https://github.com/joaodos3v "joaodos3v (2 commits)")[![robgeorgeuk](https://avatars.githubusercontent.com/u/1017415?v=4)](https://github.com/robgeorgeuk "robgeorgeuk (1 commits)")

---

Tags

docxphpphp-replacerword-documentsphpdocxreplace

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/irebega-docx-replacer/health.svg)

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

###  Alternatives

[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.2k57.6M131](/packages/openspout-openspout)[jupitern/docx

docx tools - template engine, merge docx files

16148.5k](/packages/jupitern-docx)[daandesmedt/phpheadlesschrome

A PHP wrapper for using Google Chrome Headless mode. Convert URL or HTML to a PDF / screenshot. Easy to use and OOP interfaced.

92233.1k](/packages/daandesmedt-phpheadlesschrome)[kartik-v/mpdf

A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support. This is a fork of the official mPDF library.

39328.4k1](/packages/kartik-v-mpdf)[kiwilan/php-ebook

PHP package to read metadata and extract covers from eBooks, comics and audiobooks.

3414.6k1](/packages/kiwilan-php-ebook)

PHPackages © 2026

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