PHPackages                             pureware/template-generator - 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. pureware/template-generator

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

pureware/template-generator
===========================

PHP based file generator with twig templates

0.2.1(3y ago)0139↓100%MITPHPPHP ^7.4|^8.0

Since Sep 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/pureware/template-generator)[ Packagist](https://packagist.org/packages/pureware/template-generator)[ RSS](/packages/pureware-template-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (7)Versions (7)Used By (0)

PHP based template generator with twig templates
================================================

[](#php-based-template-generator-with-twig-templates)

A php based template generator for files of every language. Pass a directory with template files, pass variables for template and create files in a given destination.

Install
-------

[](#install)

```
composer require pureware/template-generator

```

General Usage
-------------

[](#general-usage)

### Twig Parser

[](#twig-parser)

First pass the template variables with values to the twig parser

```
$parser = new Pureware\TemplateGenerator\Parser\TwigParser();
$parser->setTemplateData(
    [
        'data' => 'value',
    ]
);
```

### Tree builder

[](#tree-builder)

Then create a virtual files Tree. You can create a new directory or leave it empty.

```
$treeBuilder = new Pureware\TemplateGenerator\TreeBuilder\TreeBuilder();
$treeBuilder->skip(['path/to/file/or/dirrectory']); //skip file or dir
$files = $treeBuilder->buildTree('../templates', 'YourNewDirectory'); // your templates
```

### Templates generator

[](#templates-generator)

Pass the files and directories you want to create to the template generator

```
$generator = new DirectoryGenerator('destination/path/for/your/new/files/YourNewDirectory, $parser);
$generator->setForce(true); //allows you to overrite already existing files
$generator->generate($files);
```

Templates
---------

[](#templates)

Basically you can use default twig syntax

### Change string case

[](#change-string-case)

The twig environment uses the symfony `UnicodeString` extension:

camelCase

```
{{value|u.camel}}
```

PascalCase

```
{{value|u.camel.title}}
```

Snake

```
{{value|u.snake}}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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.

###  Release Activity

Cadence

Every ~15 days

Total

5

Last Release

1275d ago

PHP version history (2 changes)0.0.1PHP ^8.0

0.2.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0237a4b096c99a04cb66dd0f44faba8b328229b3bae3caf9f7c3f6a42e14527?d=identicon)[pureware](/maintainers/pureware)

---

Top Contributors

[![pureware](https://avatars.githubusercontent.com/u/112801862?v=4)](https://github.com/pureware "pureware (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisRector

### Embed Badge

![Health badge](/badges/pureware-template-generator/health.svg)

```
[![Health](https://phpackages.com/badges/pureware-template-generator/health.svg)](https://phpackages.com/packages/pureware-template-generator)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[vincentlanglet/twig-cs-fixer

A tool to automatically fix Twig code style

3348.4M67](/packages/vincentlanglet-twig-cs-fixer)

PHPackages © 2026

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