PHPackages                             mklocke/docnamic - 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. mklocke/docnamic

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

mklocke/docnamic
================

The document template engine

346.2k↓36.1%3[1 issues](https://github.com/mariusklocke/docnamic/issues)PHP

Since Oct 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mariusklocke/docnamic)[ Packagist](https://packagist.org/packages/mklocke/docnamic)[ RSS](/packages/mklocke-docnamic/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Docnamic - The document template engine
=======================================

[](#docnamic---the-document-template-engine)

Docnamic is a template engine for OpenDocument files (\*.odt) based on PHP's DOM and ZIP extensions. My goal is to provide a simple document generation library whose templates can be easily created using standard WYSIWYG OpenDocument software. I am interested if this library is useful for anybody out there and i will appreciate any feedback on Github or via email.

Please note that the public API should not be considered stable yet.

I will add tests once i am sure about the internal class interfaces.

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

[](#requirements)

- PHP 5.6 or later
- DOM extension
- ZIP extension

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

[](#installation)

Install this library via composer.

```
$ composer require mklocke/docnamic
```

Usage
-----

[](#usage)

Have a look at the folder `examples` which contains examples of how the library should be used.

```
$renderer = new Renderer();
$renderer->loadTemplate('template.odt')
         ->setData(['foo' => 'bar'])
         ->render('result.odt');
```

Convert to PDF
--------------

[](#convert-to-pdf)

The resulting OpenDocument files can be easily converted to PDF using the `unoconv` CLI tool on most linux distributions.

Installation on Ubuntu: `sudo apt-get install unoconv`

Convert a ODT file to PDF: `unoconv -f pdf -o result.pdf result.odt`

FAQ
---

[](#faq)

- Can i use barcodes or QR Codes?

    Yes, you can by using barcode fonts in your document template. OpenDocument files can have embedded fonts. If you use LibreOffice for creating your document templates, read their help pages regarding [Embedding Fonts](https://help.libreoffice.org/Common/Embedding_Fonts)
- Can i use nested loops in my document template?

    No, for now nested loops are not supported.
- Can i use dynamic images?

    No, dynamic images are not supported yet.
- What about encodings?

    As OpenDocument is a UTF-8-based XML file format, your data should be UTF-8 encoded as well ;)
- What about i18n or l10n?

    As this is a rather simple template engine, it has no notion of languages, countries or currencies. This has be taken care of the integrating application.

Inspired by
-----------

[](#inspired-by)

- [Secretary](https://github.com/christopher-ramirez/secretary)
- [docxtemplater](https://github.com/open-xml-templating/docxtemplater)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3683d6901a5292d4f3186d0cc48df74a220ec15dc77f35ac56cdd93c95dd3313?d=identicon)[mklocke](/maintainers/mklocke)

---

Top Contributors

[![mariusklocke](https://avatars.githubusercontent.com/u/7437495?v=4)](https://github.com/mariusklocke "mariusklocke (1 commits)")

---

Tags

odtopendocumenttemplatestemplating

### Embed Badge

![Health badge](/badges/mklocke-docnamic/health.svg)

```
[![Health](https://phpackages.com/badges/mklocke-docnamic/health.svg)](https://phpackages.com/packages/mklocke-docnamic)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

555.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

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