2017 © Pedro Peláez
 

library ru-php-stamp

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

image

ownercoder/ru-php-stamp

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  • Monday, December 25, 2017
  • by ownercoder
  • Repository
  • 1 Watchers
  • 0 Stars
  • 23 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 28 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

PHPStamp

PHPStamp is a simple PHP templating library for XML-based Microsoft Word documents.
Library aims to provide native XML-way of templating this documents as an altenative to treating DOM document as a string for regex replacing, which has a lot of downsides., (*1)

Basically it tries to clean messy WYSIWYG-generated code and create reusable XSL stylesheet from document.
Some additional information:
(EN) https://redd.it/30conp
(RU) http://habrahabr.ru/post/244421/, (*2)

Features

  • Current version supports Microsoft Office OpenXML DOCX format.
  • Configurable brackets for tags-placeholders.
  • Basic extension system, which helps generating content blocks such as Cells or ListItems.
  • Caching XSL template to filesystem.

Requirements

Library requires PHP 5.3+ with DOM, XSL and Zip extensions.
Also depends on doctrine2/Lexer package., (*3)

Installation

Install with Composer., (*4)

composer require shadz3rg/php-stamp, (*5)

or, (*6)

{
    "require": {
        "shadz3rg/php-stamp": "0.1.*"
    }
}

Usage

Template.

alt tag, (*7)

<?php
    require 'vendor/autoload.php';

    use PHPStamp\Templator;
    use PHPStamp\Document\WordDocument;

    $cachePath = 'path/to/writable/directory/';
    $templator = new Templator($cachePath);

    $documentPath = 'path/to/document.docx';
    $document = new WordDocument($documentPath);

    $values = array(
        'library' => 'PHPStamp 0.1',
        'simpleValue' => 'I am simple value',
        'nested' => array(
            'firstValue' => 'First child value',
            'secondValue' => 'Second child value'
        ),
        'header' => 'test of a table row',
        'students' => array(
            array('id' => 1, 'name' => 'Student 1', 'mark' => '10'),
            array('id' => 2, 'name' => 'Student 2', 'mark' => '4'),
            array('id' => 3, 'name' => 'Student 3', 'mark' => '7')
        ),
        'maxMark' => 10,
        'todo' => array(
            'TODO 1',
            'TODO 2',
            'TODO 3'
        )
    );
    $result = $templator->render($document, $values);
    $result->download();
Result.

alt tag, (*8)

The Versions

25/12 2017

dev-master

9999999-dev

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  Sources   Download

MIT

The Development Requires

by Avatar Oleg

template word docx

25/12 2017

0.1.6

0.1.6.0

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  Sources   Download

MIT

The Development Requires

by Avatar Oleg

template word docx

25/12 2017

dev-ParseRunningTitle

dev-ParseRunningTitle

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  Sources   Download

MIT

The Development Requires

by Avatar Oleg

template word docx

10/11 2017

0.1.5

0.1.5.0

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  Sources   Download

MIT

The Development Requires

by Avatar Oleg

template word docx

09/11 2017

0.1.4

0.1.4.0

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  Sources   Download

MIT

The Development Requires

by Avatar Oleg

template word docx

09/11 2017

dev-Hotfix-fix_utf8_lexem

dev-Hotfix-fix_utf8_lexem

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  Sources   Download

MIT

The Development Requires

by Avatar Oleg

template word docx

31/10 2017

0.1.3

0.1.3.0

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Oleg

template word docx

31/10 2017

dev-FixRussianLexem

dev-FixRussianLexem

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Oleg

template word docx

07/08 2017

0.1.2

0.1.2.0

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  Sources   Download

MIT

The Requires

 

by Avatar Oleg

template word docx

26/05 2017

0.1.1

0.1.1.0

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  Sources   Download

MIT

The Requires

 

by Avatar Oleg

template word docx

03/04 2017

0.1

0.1.0.0

A library for true XSL-way templating of XML-based Office documents. Supports MS Word docx.

  Sources   Download

MIT

The Requires

 

by Avatar Oleg

template word docx

13/10 2014

dev-odt

dev-odt

A library for templating XML based office documents (such as .docx, .odt)

  Sources   Download

The Requires

 

by Avatar Oleg G.