icircle / docx-template-in-php
Create Templates in MS Word docx format and use them Creating Business documents using PHP
Installs: 22 300
Dependents: 0
Suggesters: 0
Security: 0
Stars: 39
Watchers: 7
Forks: 17
Open Issues: 3
Requires
- php: >=5.3.0
- pear/numbers_words: dev-master
Requires (Dev)
- phpunit/phpunit: 4.5.*
This package is not auto-updated.
Last update: 2025-01-04 19:32:08 UTC
README
Create Templates in MS Word docx format and use them Creating Business documents using PHP
What's New
Changed the namespace of DocxTemplate
from default to icircle\Template\Docx
Introduction
This library merges the data in php array into docx file.
The template docx file can be created in MS Word, To specify keys use [key] format in MS Word (i.e, specify the array indices inside the square bracket)
Example
for the data
{ "host":{ "name":"Host Company", "address":"1st Main, 2nd Cross, Bangalore" } }
the possible keys are [host.name] [host.address]
Basic Usage
use icircle\Template\Docx\DocxTemplate; $docxTemplate = new DocxTemplate('path/to/template/file'); $dataArray = array() // fill the $dataArray with data $docxTemplate->merge($dataArray,'path/to/output/file');
For More Usage please see the included tests or contact me