PHPackages                             natmars/yii2-word - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. natmars/yii2-word

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

natmars/yii2-word
=================

Helper and wrapper class for PHPWord for simple communication

1.1(6y ago)0110BSD-3-ClausePHPPHP &gt;=5.4

Since Nov 12Pushed 6y agoCompare

[ Source](https://github.com/natmars/yii2-word)[ Packagist](https://packagist.org/packages/natmars/yii2-word)[ Docs](https://github.com/strong2much/yii2-word.git)[ RSS](/packages/natmars-yii2-word/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

yii2-word
=========

[](#yii2-word)

Helper and wrapper class for PHPWord for simple communication.

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

[](#installation)

Either run

```
$ php composer.phar require natmars/yii2-word "@dev"

```

or add

```
"natmars/yii2-word": "@dev"

```

Creating a multi-line file using the word template
--------------------------------------------------

[](#creating-a-multi-line-file-using-the-word-template)

### 1. Creating Your First Template

[](#1-creating-your-first-template)

Create a Microsoft Word file.

Use `${variableName}` to set variables. Use `${tableName}`, `${itemName}` to generate a table (the value of `${tableName}` is set to empty, but the values ​​of `${itemName}` are set to match a data in an array). Result will look like this:

[![Word Template Screenshot](/example/templates/template.png?raw=true)](/example/templates/template.png?raw=true)

### 2. Saving template

[](#2-saving-template)

Set the file name as `$fileName`, put the file in the template directory `$templatesDir` and determine the location to save the finished file `$tmpDir`

### 3. Generating the report

[](#3-generating-the-report)

```
use natmars\word\Word;

$templateFullPath = $templatesDir . $fileName;
$outputFullPath = $tmpDir . $fileName;

$phpWord = new Word();

// create a file using a template
$phpWord->saveFromMultiLineTemplate($templateFullPath, $outputFullPath, [
    'variableName' => 'variableValue',
    'tableName' => [
        ['itemName' => 'itemValue1'],
        ['itemName' => 'itemValue2'],
        ['itemName' => 'itemValue3'],
    ],
]);

// download file
$phpWord->downloadTemplate($outputFullPath);
```

### 4. Check your output report document

[](#4-check-your-output-report-document)

Your output should look something like below:

[![Output Document Screenshot](/example/templates/output.png?raw=true)](/example/templates/output.png?raw=true)

Run for example:

```
\natmars\example\Test::generate();

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~12 days

Total

2

Last Release

2360d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8364222?v=4)[Natalia](/maintainers/natmars)[@natmars](https://github.com/natmars)

---

Top Contributors

[![natmars](https://avatars.githubusercontent.com/u/8364222?v=4)](https://github.com/natmars "natmars (3 commits)")[![dtatarnikov](https://avatars.githubusercontent.com/u/4092580?v=4)](https://github.com/dtatarnikov "dtatarnikov (2 commits)")

---

Tags

wordPhpWordyii2

### Embed Badge

![Health badge](/badges/natmars-yii2-word/health.svg)

```
[![Health](https://phpackages.com/badges/natmars-yii2-word/health.svg)](https://phpackages.com/packages/natmars-yii2-word)
```

###  Alternatives

[phpnt/yii2-export

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

158.9k](/packages/phpnt-yii2-export)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)

PHPackages © 2026

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