PHPackages                             matronator/mtrgen - 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. [CLI &amp; Console](/categories/cli)
4. /
5. matronator/mtrgen

ActiveLibrary[CLI &amp; Console](/categories/cli)

matronator/mtrgen
=================

PHP file generator engine for generating files from templates.

v2.3.1(2mo ago)7137↓100%[1 issues](https://github.com/matronator/MTRGen/issues)MITPHPPHP &gt;=8.1CI failing

Since Sep 3Pushed 5d ago1 watchersCompare

[ Source](https://github.com/matronator/MTRGen)[ Packagist](https://packagist.org/packages/matronator/mtrgen)[ GitHub Sponsors](https://github.com/sponsors/matronator)[ Fund](https://ko-fi.com/matronator)[ RSS](/packages/matronator-mtrgen/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (11)Versions (26)Used By (0)

MTRGen
======

[](#mtrgen)

[![MTRGen Logo](docs/assets/images/logo.png)](docs/assets/images/logo.png)

*Generate files from templates with ease.*

[![Latest Stable Version](https://camo.githubusercontent.com/cdd4608c544b2275d92e21311ea885f71d86c92b9e41a4529afa67d4e9885ab4/68747470733a2f2f706f7365722e707567782e6f72672f6d6174726f6e61746f722f6d747267656e2f76)](https://packagist.org/packages/matronator/mtrgen)[![Total Downloads](https://camo.githubusercontent.com/0c4512915a8de28da9f8fe867c861c6a40ef3feb19f0652a2ecfe80144c2f54f/68747470733a2f2f706f7365722e707567782e6f72672f6d6174726f6e61746f722f6d747267656e2f646f776e6c6f616473)](https://packagist.org/packages/matronator/mtrgen)[![License](https://camo.githubusercontent.com/2c7ac1a56cfcbb5db55838d73ceeb0b489b192c9f7257dae66f15c3e64b83f1e/68747470733a2f2f706f7365722e707567782e6f72672f6d6174726f6e61746f722f6d747267656e2f6c6963656e7365)](https://packagist.org/packages/matronator/mtrgen)

#### [Official Website](https://mtrgen.matronator.cz) | [Documentation](https://mtrgen.matronator.cz/public/docs/) | [Template Repository](https://mtrgen.matronator.cz/repository)

[](#official-website--documentation--template-repository)

File generator for source code files.

MTRGen is a CLI tool that can be used in any project and generate files in any language. Create your own templates or use templates from the [online repository](https://mtrgen.matronator.cz/repository). MTRGen is a great tool for generating boilerplate code, but it can also be used to generate any other type of file.

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

[](#requirements)

- PHP &gt;= 8.1
- Composer

Instalation
-----------

[](#instalation)

Install with Composer:

```
composer require matronator/mtrgen

```

#### Troubleshooting

[](#troubleshooting)

If you get this error when trying to install:

```
matronator/mtrgen v1.0.0 requires composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint.

```

Run this command to update composer to the latest version:

```
composer self-update

```

If you can't or don't want to update composer, use version `"^1.0"` of this package as that doesn't depend on Composer runtime API 2.2.

Documentation
-------------

[](#documentation)

[Read the full documentation here](https://mtrgen.matronator.cz/docs) *- needs to be updated to version 2!*

Quickstart
----------

[](#quickstart)

Here are some examples of commands you can run with MTRGen:

```
# To list all available commands
vendor/bin/mtrgen list

# To see usage of the generate command
vendor/bin/mtrgen generate --help
vendor/bin/mtrgen gen -h

# Generate from file
vendor/bin/mtrgen generate --path=my/folder/template.json
vendor/bin/mtrgen gen -p my/folder/template.json

# Generate from the global store
vendor/bin/mtrgen generate TemplateName

# Download template from the online repository and save it to the global store
vendor/bin/mtrgen add vendor/template
vendor/bin/mtrgen a vendor/template

# Save a template to the global store
vendor/bin/mtrgen save path/to/template.json
vendor/bin/mtrgen s path/to/template.json

# Optionally provide an alias to save the template under
vendor/bin/mtrgen save path/to/template.json --alias=NewName

# Save a bundle to the global store
vendor/bin/mtrgen save-bundle BundleName path/to/template1.json path/to/template2.json
vendor/bin/mtrgen sb BundleName path/to/template1.json path/to/template2.json

# Remove a template from the global store
vendor/bin/mtrgen remove TemplateName
vendor/bin/mtrgen rm TemplateName

# Repair the global store (remove all templates that don't exist)
vendor/bin/mtrgen repair
vendor/bin/mtrgen r
```

License
-------

[](#license)

MIT License

Copyright (c) 2022 Matronator

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance89

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 65.7% 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 ~57 days

Recently: every ~146 days

Total

22

Last Release

88d ago

Major Versions

v1.1.1b4 → v2.0.0-alpha2023-05-19

v1.x-dev → v2.x-dev2024-01-10

PHP version history (2 changes)1.0.0PHP &gt;=7.4

v2.0.0-alphaPHP &gt;=8.1

### Community

Maintainers

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

---

Top Contributors

[![matronator](https://avatars.githubusercontent.com/u/5470780?v=4)](https://github.com/matronator "matronator (237 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (100 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (24 commits)")

---

Tags

clicli-appcli-generationcli-generatorcli-generatorscli-toolcode-generationcode-generatorcode-generatorscommand-line-appcommand-line-toolfile-generationfile-generatorgeneratorgenerator-templategeneratorsmtrgenphpphp-generatortemplatesgeneratorneonjson-templatesphp generatorfile generatorfile generationyaml-templatesfile templates

### Embed Badge

![Health badge](/badges/matronator-mtrgen/health.svg)

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

###  Alternatives

[apigen/apigen

PHP source code API generator.

2.2k627.3k199](/packages/apigen-apigen)[platformsh/cli

Platform.sh CLI

22937.9k](/packages/platformsh-cli)[shopwarelabs/sw-cli-tools

A CLI toolset for shopware

843.2k](/packages/shopwarelabs-sw-cli-tools)

PHPackages © 2026

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