PHPackages                             molbio-unige/php-word-view - 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. molbio-unige/php-word-view

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

molbio-unige/php-word-view
==========================

PhpWordView plugin for CakePHP

1.1.1(3y ago)121MITPHP

Since Aug 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/MolbioUnige/cakephp-phpwordview)[ Packagist](https://packagist.org/packages/molbio-unige/php-word-view)[ RSS](/packages/molbio-unige-php-word-view/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (5)Used By (0)

PhpWordView plugin for CakePHP
==============================

[](#phpwordview-plugin-for-cakephp)

This plugin renders Word documents using the [PhpWord](https://github.com/PHPOffice/PHPWord) library. This plugin uses the `TemplateProcessor` of PhpWord.

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](https://getcomposer.org).

The recommended way to install composer packages is:

```
composer require molbio-unige/php-word-view

```

### Enable plugin

[](#enable-plugin)

Load the plugin by running command

```
bin/cake plugin load PhpWordView

```

Usage
-----

[](#usage)

Two different ways to render.

### PHPWord TemplateProcessor

[](#phpword-templateprocessor)

To be used if you need to render simple documents. Serialize the data you want to insert into the template.

The templates are expected to be present in `src/Templates/Model/docx/`, and having `.docx` filename extension. Template files are just plain word document, not Word model documents.

[Create a template document](https://phpword.readthedocs.io/en/latest/templates-processing.html)

```
public function imprimatur()
{
    $imprimatur = '667';
    $this->viewBuilder()
         ->setClassName('PhpWordView.PhpWord');

    $data = [
        'title' => 'Beati Pauperes Spiritu,
        'imprimatur' => $imprimatur,
    ];
    $_serialize = 'data';
    $this->set(compact('data', '_serialize'));
}
```

### PHPWord full api

[](#phpword-full-api)

To be used when a simple search-replace is not sufficient.

The view files are expected to be present in `src/Templates/Model/docx/`, but having `.ctp` filename extension. Inside your view files you will have access to the PHPWord library with `$this->PhpWord`. Check the [PHPWord](https://github.com/PHPOffice/PHPWord) documentation on how to use PHPWord.

Don't set the `_serialize` variable.

```
public function imprimatur($id)
{
    $this->viewBuilder()
         ->setClassName('PhpWordView.PhpWord');
    $imprimatur = $this->Imprimaturs->get($id);
    $this->set(compact('imprimatur'));
}
```

### Downloaded filename

[](#downloaded-filename)

The downloaded filename can be specified with the viewBuilder options, default is the action name.

```
    $this->viewBuilder()
         ->setClassName('PhpWordView.PhpWord')
         ->options([
             'wordConfig' => [
                 'filename' => 'imprimatur-' . $id,
             ]
         ]);
```

Troubleshooting
---------------

[](#troubleshooting)

A `Could not close zip file /tmp/PhpWord5gJC0Z` Exception might mean that there is a problem with the template.docx file have incorrect line ending. This can be solved by specifying docx files as binary in the `.gitattributes` file.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Total

4

Last Release

1353d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/44c21f5dfbb2cd0be4634b0aadc6be379670faff8cad7226b04c1a44bdb8143b?d=identicon)[MolbioUnige](/maintainers/MolbioUnige)

---

Top Contributors

[![MolbioUnige](https://avatars.githubusercontent.com/u/27211819?v=4)](https://github.com/MolbioUnige "MolbioUnige (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/molbio-unige-php-word-view/health.svg)

```
[![Health](https://phpackages.com/badges/molbio-unige-php-word-view/health.svg)](https://phpackages.com/packages/molbio-unige-php-word-view)
```

###  Alternatives

[civicrm/civicrm-core

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

728272.9k17](/packages/civicrm-civicrm-core)[markstory/asset_compress

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.

3761.0M11](/packages/markstory-asset-compress)[cakedc/cakephp-phpstan

CakePHP plugin extension for PHPStan.

40676.6k31](/packages/cakedc-cakephp-phpstan)[dereuromark/cakephp-dto

A CakePHP plugin for generating immutable Data Transfer Objects with full type safety

2988.9k3](/packages/dereuromark-cakephp-dto)[dereuromark/cakephp-geo

A CakePHP plugin around geocoding tools and helpers.

51174.9k4](/packages/dereuromark-cakephp-geo)[cakedc/enum

Enumeration list Plugin for CakePHP 5

30222.5k2](/packages/cakedc-enum)

PHPackages © 2026

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