PHPackages                             bezirovoviku/temgen - 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. bezirovoviku/temgen

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

bezirovoviku/temgen
===================

Template generator

015PHP

Since Jan 3Pushed 10y ago1 watchersCompare

[ Source](https://github.com/bezirovoviku/temgen)[ Packagist](https://packagist.org/packages/bezirovoviku/temgen)[ RSS](/packages/bezirovoviku-temgen/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Template generator
==================

[](#template-generator)

This is simple template system for document files. It uses text replacement, allows cyclical replacements and basic filters.

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

[](#installation)

You can install this library using composer

```
composer require bezirovoviku/temgen

```

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

[](#requirements)

LibreOffice (2+) - only for OPDF converter

PhantomJS - only for PPDF converter

Usage
-----

[](#usage)

First you will need to include the generator class

```
use Temgen\Generator;
```

then use generator class as follows

```
//Creates generator
$generator = new Generator();
//Adds basic filters
$generator->addFilters();
//Sets temporary folder used to store documents
$generator->setTmp('/tmp');
//Sets path to template file
$generator->setTemplate(new Document('template.html'));
//Generates zip archive from specified data
$generator->generateArchive(json_decode($this->data, true), 'archive.zip');
```

Creating custom filters
-----------------------

[](#creating-custom-filters)

To create custom filter, you will need to implement \\Temgen\\Generator\\Filter interace

```
class MyFilter implements \Temgen\Generator\Filter
{
	/**
	 * Returns tag used to identify filter
	 *
	 * @return string tag identifing filter
	 */
	public function getTag() {
	  return 'myfilter';
	}

	/**
	 * Filter given arguments and return result
	 *
	 * @param \Temgen\Generator $generator generator calling this filter
	 * @param array           $context   replacing context
	 * @param array           $arguments arguments passed to filter
	 * @param string|null     $input     pipe input (if present)
	 * @return string result
	 */
	public function filter($generator, $context, $arguments, $input) {
	  return strtoupper($input);
	}
}
```

then you will need to add instance of this filter to generator instance, like so:

```
$generator = new Generator();
$generator->addFilter(new MyFilter());
```

now, in this generator instance, filter MyFilter will be accessible by {myfilter} syntax

Exporting pdf
-------------

[](#exporting-pdf)

This requires libreoffice installed

```
//Creates docx generator
$generator = new Generator\Docx();
//PDF converter
$converter = new Converter\OPDF();
//Adds basic filters
$generator->addFilters();
//Sets temporary folder used to store documents
$generator->setTmp('/tmp');
//Sets path to template file
$generator->setTemplate(new Document\Docx('template.docx'));
//Generates zip archive from specified data, converts using converter
$generator->generateArchive(json_decode($this->data, true), 'archive.zip', $converter);
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

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://avatars.githubusercontent.com/u/2076742?v=4)[Jan Zípek](/maintainers/SkaceKamen)[@SkaceKamen](https://github.com/SkaceKamen)

---

Top Contributors

[![SkaceKamen](https://avatars.githubusercontent.com/u/2076742?v=4)](https://github.com/SkaceKamen "SkaceKamen (13 commits)")

### Embed Badge

![Health badge](/badges/bezirovoviku-temgen/health.svg)

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

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3861.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.0k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.2k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

281.8k](/packages/webkinder-sproutset)

PHPackages © 2026

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