PHPackages                             dhutapratama/mydocx - 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. dhutapratama/mydocx

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

dhutapratama/mydocx
===================

MsOffice .docx templating, find and replace, merge, add an image for PHP

v1.0.7(6y ago)1941MITPHPPHP &gt;=7.0.0

Since Dec 15Pushed 6y ago1 watchersCompare

[ Source](https://github.com/dhutapratama/MyDocx)[ Packagist](https://packagist.org/packages/dhutapratama/mydocx)[ Docs](https://github.com/dhutapratama/mydocx)[ RSS](/packages/dhutapratama-mydocx/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (6)Used By (0)

MyDocx
======

[](#mydocx)

PHP Library for merge, find some text and replace to text or image in docx document. Note that this library is never tested for OpenOffice format.

This library is downloaded from **** since no update from Dec 2016. Issue are very welcome to report here.

Features
--------

[](#features)

- Find text and replace with text and image
- Merge docx files on one file

###### Note : Merge document here is include new file into existing file and show as one document or existing page is not modified

[](#note--merge-document-here-is-include-new-file-into-existing-file-and-show-as-one-document-or-existing-page-is-not-modified)

Requirements
------------

[](#requirements)

- PHP 5.4 +

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

[](#installation)

MyDocx is installed via [Composer](https://getcomposer.org/). To [add a dependency](https://getcomposer.org/doc/04-schema.md#package-links) to MyDocx in your project, either

Run the following to use the latest stable version

```
    composer require dhutapratama/mydocx
```

You can of course also manually edit your composer.json file

```
{
    "require": {
       "dhutapratama/mydocx": "v1.0.*"
    }
}
```

Getting started
---------------

[](#getting-started)

#### Declaration

[](#declaration)

```
use Dhutapratama\MyDocx\Docx;

// Initialization
$myDocx = new Docx('/mydir/template.docx');
```

#### Replacing Header and/or Footer

[](#replacing-header-andor-footer)

```
$myDocx->setHeaderFooter(['text_to_find' => 'value to replace'])
  ->save();
```

#### Replacing Text

[](#replacing-text)

```
$myDocx->setText(['text_to_find' => 'value to replace'])
  ->save();
```

#### Replacing Image

[](#replacing-image)

```
$myDocx->setImage(['text_to_find' => '/your/image.png'])
  ->save();
```

#### Merge Files

[](#merge-files)

```
$myDocx->setMerge(['/your/file1.docx', '/your/file2.docx'])
  ->save();
```

#### Replace and merge

[](#replace-and-merge)

```
$myDocx->setText(['text_to_find' => 'value to replace'])
  ->setImage(['text_to_find' => '/your/image.png'])
  ->setMerge(['/your/file1.docx', '/your/file2.docx'])
  ->save();
```

Contributing
------------

[](#contributing)

Please report any issue or you can also help others to resolving issues by fork and requesting merge to master branch.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

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 ~3 days

Total

5

Last Release

2324d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

phpdocxdocx templatedocx mergeimage to docx

### Embed Badge

![Health badge](/badges/dhutapratama-mydocx/health.svg)

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

###  Alternatives

[openspout/openspout

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

1.1k57.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)[irebega/docx-replacer

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

1432.1k](/packages/irebega-docx-replacer)[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)
