2017 © Pedro Peláez
 

library word-template

Generate word documents from word templates using PHP.

image

archfz/word-template

Generate word documents from word templates using PHP.

  • Friday, April 7, 2017
  • by archfz
  • Repository
  • 1 Watchers
  • 2 Stars
  • 128 Installations
  • C++
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

Word Template

This package provides a binary executable to generate word from templates and a wrapper object WordTemplate to use it in PHP. The binary is compiled from c++, which uses the DocxFactory third party library., (*1)

Requirements

The usage relies on a system executable. This means that certain libraries are required. - GCC v5+ - by installing gcc you should have most of these libraries available - libstdc++ 6.0.21 - in certain cases you might have issues (like on centos); the problem you might have is with this lib which needs to be configured manually (download) - PHP NTS (Non-Thread-Safe) - this is required because for some reason the thread safe is not allowed to execute the binary, (*2)

Installation

composer require archfz/word-template:1.3.x-dev

Note: require with the specified version, otherwise not the 'package' branch will be used. This branch is better as it does not include all the c++ source files and libraries that are not required for functionality., (*3)

Usage

First you need to create a template word document. This must be .docx., (*4)

In it you create placeholders with braces like the following: {placeholder}., (*5)

You can also bookmark things that you select and then these elements will be cloneable. For example bookmark the upper placeholder and name it 'myplaceholder'., (*6)

In case of the above described word template you can do the following:, (*7)

use archfz/Word/WordTemplate

$template = new WordTemplate('test.docx');

$template->paste('myplaceholder');
$template->setValue('placeholder', 'Put one here');

$template->paste('myplaceholder');
$template->setValue('placeholder', 'Put another different');

$template->compile();

Which will produce a test_compiled.docx with two lines:, (*8)

Put one here
Put another different

Contribute

To better understand or to extend functionality you can learn more here., (*9)

The Versions

07/04 2017

dev-package

dev-package

Generate word documents from word templates using PHP.

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

by Fodor Zoltan

07/04 2017

dev-master

9999999-dev

Generate word documents from word templates using PHP.

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

by Fodor Zoltan

07/04 2017

dev-develop

dev-develop

Generate word documents from word templates using PHP.

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

by Fodor Zoltan