PHPackages                             keyboarduz/php-stamp - 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. [Templating &amp; Views](/categories/templating)
4. /
5. keyboarduz/php-stamp

ActiveLibrary[Templating &amp; Views](/categories/templating)

keyboarduz/php-stamp
====================

The XSL-way templating library for MS Office Word DOCX documents.

v1.0.0(2y ago)198MITPHPPHP &gt;=7.4

Since May 13Pushed 2y agoCompare

[ Source](https://github.com/keyboarduz/php-stamp)[ Packagist](https://packagist.org/packages/keyboarduz/php-stamp)[ Docs](https://github.com/keyboarduz/php-stamp)[ RSS](/packages/keyboarduz-php-stamp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

PHPStamp
========

[](#phpstamp)

PHPStamp is a simple templating engine for [XML-based Microsoft Word documents](https://learn.microsoft.com/en-us/office/open-xml/word/structure-of-a-wordprocessingml-document?tabs=cs).
Library aims to provide native XML-way of templating for DOCX documents as an alternative to treating its content as a plain text for regex replacing, which has a lot of downsides.
Instead it tries to clean messy WYSIWYG-generated code and create reusable XSL stylesheet from document.

Some additional information:
(EN)
(RU)

Features
--------

[](#features)

- Caching XSL template to filesystem for fast document render.
- Track document mode - generate and cache new template if original document was updated.
- Configurable brackets for placeholder tags.
- Basic extension system, which helps to generate content blocks such as Cells or ListItems.

Known issues
------------

[](#known-issues)

Values inserted into placeholder tags may be highlighted as incorrect by spellcheck, since library removes language attribute and MS Word tries to check it with system language.

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

[](#requirements)

Library requires PHP 7.4+ with DOM, XSL, Zip extensions.

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

[](#installation)

Install with Composer:

`composer require shadz3rg/php-stamp`

Usage
-----

[](#usage)

##### Template:

[](#template)

[![alt tag](https://camo.githubusercontent.com/a2d5cdcd4bc1efb7fe3e7faf08c262379b11cd7c40d34889304c395fe5b9dedb/68747470733a2f2f686162726173746f726167652e6f72672f66696c65732f3062662f6462662f6638392f30626664626666383936626134356531616339363663353461626430353061612e706e67)](https://camo.githubusercontent.com/a2d5cdcd4bc1efb7fe3e7faf08c262379b11cd7c40d34889304c395fe5b9dedb/68747470733a2f2f686162726173746f726167652e6f72672f66696c65732f3062662f6462662f6638392f30626664626666383936626134356531616339363663353461626430353061612e706e67)

```
