承接 mklocke/docnamic 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mklocke/docnamic

Composer 安装命令:

composer require mklocke/docnamic

包简介

The document template engine

README 文档

README

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

  • PHP 5.6 or later
  • DOM extension
  • ZIP extension

Installation

Install this library via composer.

$ composer require mklocke/docnamic

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

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

  • 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

  • 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

统计信息

  • 总下载量: 45.22k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固