PHPackages                             jhon/word\_replacer\_wrapper - 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. jhon/word\_replacer\_wrapper

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

jhon/word\_replacer\_wrapper
============================

realiza reemplazo de palabras en plantillas de word y realiza la conversion del archivo final a extensiones requeridas como pdf

2.4.1(4y ago)16521MITPHP

Since Feb 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/jsvptf22/word_replacer_wrapper)[ Packagist](https://packagist.org/packages/jhon/word_replacer_wrapper)[ Docs](https://github.com/jsvptf22/word_replacer_wrapper)[ RSS](/packages/jhon-word-replacer-wrapper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (11)Used By (0)

word replacer wrapper
=====================

[](#word-replacer-wrapper)

replace words on .docx files and convert to pdf

install with

```
composer require jhon/word_replacer_wrapper

```

Dependencies
============

[](#dependencies)

```
You need to install LibreOffice.

```

Usage
=====

[](#usage)

You must include vendor/autoload.php

```
require __DIR__ . '/vendor/autoload.php';

```

Class namespace

```
use Jsvptf\WordReplacerWrapper\WordReplacerWrapper;

```

Default configuration

```
//template to process
$template = 'templateDirectory/test.docx';

```

Define data to convert

```
//array of ITypeTableChild elements
$tableData = [
        [
            new Text('a'),
            new Text('b'),
        ],
        [
            new Text('d'),
            new Table($nestedTableData),
        ]
];

//default configuration, array of IType elements

$data = [
    'field1' => new Text('xxxxxxxxxxx'),
    'field2' => new Table($tableData),
    'field3' => new Image('./images/test.png', 80, 80),
    'field4' => new Pagination('Page {PAGE} of {NUMPAGES}.'),
    'styleText' => new Text('some with style', [
        'size' => 20,
        'bold' => true,
        'name' => 'Courier New'
    ])
];

//folder for create files
$temporalDirectory = 'testOne';

$WordReplacerWrapper = new WordReplacerWrapper(
    'templateDirectory/test.docx', //docx template
    $data, //data to replace
    'prueba1', //destination folder
    'libreoffice' //libreoffice binary
);

//execute replace and convert to pdf
$routes = $WordReplacerWrapper->replaceData();

//routes
["template"]=>
  string(17) "testOne/test.docx"
["document"]=>
  string(26) "testOne/document_test.docx"
["pdf"]=>
  string(25) "testOne/document_test.pdf"

```

Dinamic configuration
=====================

[](#dinamic-configuration)

```
//if you want to know the required variables you can use
$fields = $WordReplacerWrapper->getRequiredFields()

//$fields
array(7) {
  [0]=>
  string(6) "field1"
  [1]=>
  string(6) "field3"
  [5]=>
  string(6) "header"
  [6]=>
  string(6) "footer"
}

$WordReplacerWrapper->setData(['field1' => new Text('sebastian')]);
$WordReplacerWrapper->setTemporalDir('testTwo');
$routes = $WordReplacerWrapper->replaceData();

//routes
["template"]=>
  string(17) "testTwo/test.docx"
["document"]=>
  string(26) "testTwo/document_test.docx"
["pdf"]=>
  string(25) "testTwo/document_test.pdf"

```

Header and footer
=================

[](#header-and-footer)

you must add header and footer key to data, implementing a Jsvptf\\WordReplacerWrapper\\types\\Table class and the template file MUST has content on header and footer space, you can see it on example/convertDocx.php

```
$data = [
    'header' => new Table($tableData),
    'footer' => new Table($tableData)
    ...
];

```

You can find the complete example on example directory

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 86.7% 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 ~56 days

Recently: every ~118 days

Total

10

Last Release

1762d ago

Major Versions

1.0.0 → 2.0.02020-03-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/96ff43a4e72319fa4a9d831114aeee6d3187bf73eceb69fbddfc6db536c7b6e4?d=identicon)[jsvptf22](/maintainers/jsvptf22)

---

Top Contributors

[![jsvptf22](https://avatars.githubusercontent.com/u/25599742?v=4)](https://github.com/jsvptf22 "jsvptf22 (26 commits)")[![ceroksaia](https://avatars.githubusercontent.com/u/53920118?v=4)](https://github.com/ceroksaia "ceroksaia (4 commits)")

---

Tags

docxphpphpwordphpword

### Embed Badge

![Health badge](/badges/jhon-word-replacer-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/jhon-word-replacer-wrapper/health.svg)](https://phpackages.com/packages/jhon-word-replacer-wrapper)
```

###  Alternatives

[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)[novay/laravel-word-template

Package Laravel untuk melakukan penggantian kata pada file menggunakan template dokumen (.doc atau .docx) yang sudah disediakan.

4815.1k](/packages/novay-laravel-word-template)[kiwilan/php-ebook

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

3414.6k1](/packages/kiwilan-php-ebook)[phpnt/yii2-export

Yii2 It saves data in xls, csv, word, html, pdf files.

158.9k](/packages/phpnt-yii2-export)[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)

PHPackages © 2026

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