PHPackages                             coderubix/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. [File &amp; Storage](/categories/file-storage)
4. /
5. coderubix/docx-replacer

ActiveLibrary[File &amp; Storage](/categories/file-storage)

coderubix/docx-replacer
=======================

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

011PHP

Since Aug 7Pushed 1mo agoCompare

[ Source](https://github.com/developer-ashok/docx-replacer)[ Packagist](https://packagist.org/packages/coderubix/docx-replacer)[ RSS](/packages/coderubix-docx-replacer/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)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

23

—

LowBetter than 26% of packages

Maintenance59

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor1

Top contributor holds 61.1% 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.

### Community

Maintainers

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

---

Top Contributors

[![igorrebega](https://avatars.githubusercontent.com/u/2010915?v=4)](https://github.com/igorrebega "igorrebega (11 commits)")[![developer-ashok](https://avatars.githubusercontent.com/u/14976868?v=4)](https://github.com/developer-ashok "developer-ashok (4 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)")

### Embed Badge

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

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

PHPackages © 2026

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