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(5y ago)16521MITPHP

Since Feb 24Pushed 5y 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 1w 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

31

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

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

1860d ago

Major Versions

1.0.0 → 2.0.02020-03-05

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25599742?v=4)[jhon sebastian valencia](/maintainers/jsvptf22)[@jsvptf22](https://github.com/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

[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.7k441.1k8](/packages/theodo-group-llphant)[kimai/kimai

Kimai - Time Tracking

4.8k9.4k1](/packages/kimai-kimai)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

762297.9k53](/packages/civicrm-civicrm-core)[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.

93259.5k](/packages/daandesmedt-phpheadlesschrome)[novay/laravel-word-template

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

5617.8k](/packages/novay-laravel-word-template)[abydahana/aksara

Aksara is a modern, developer-friendly framework and CMS built on CodeIgniter 4, featuring rapid CRUD development, modular architecture, smart routing, flexible access control, API integration, and an AI assistant to make content management faster and smarter.

1141.2k](/packages/abydahana-aksara)

PHPackages © 2026

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