Skip to content

Commit

Permalink
Merge branch 'v2'
Browse files Browse the repository at this point in the history
  • Loading branch information
matronator committed Jan 16, 2024
2 parents de71166 + d82f019 commit fed37d3
Show file tree
Hide file tree
Showing 39 changed files with 1,318 additions and 579 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ pineal
.vscode
logo-square.pxm
.DS_Store
config.json
config.json
40 changes: 27 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,29 @@

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

#### [Official Website](https://mtrgen.com)
*Generate files from templates with ease.*

#### [Documentation](https://mtrgen.com/docs)
[![Latest Stable Version](https://poser.pugx.org/matronator/mtrgen/v)](https://packagist.org/packages/matronator/mtrgen)
[![Total Downloads](https://poser.pugx.org/matronator/mtrgen/downloads)](https://packagist.org/packages/matronator/mtrgen)
[![License](https://poser.pugx.org/matronator/mtrgen/license)](https://packagist.org/packages/matronator/mtrgen)

File generator engine that can generate PHP files from JSON/YAML/NEON templates.
#### [Official Website](https://mtrgen.com) | [Documentation](https://mtrgen.com/docs) | [Template Repository](https://mtrgen.com/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://www.mtrgen.com/repository). MTRGen is a great tool for generating boilerplate code, but it can also be used to generate any other type of file.

## Requirements

- PHP >= 7.4
- PHP >= 8.1
- Composer

## Instalation

Install with Composer:

```
composer require matronator/mtrgen --dev
composer require matronator/mtrgen
```

#### Troubleshooting
Expand All @@ -39,13 +45,13 @@ If you can't or don't want to update composer, use version `"^1.0"` of this pack

## Documentation

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

## Quickstart

You run the script from terminal using this command:
Here are some examples of commands you can run with MTRGen:

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

Expand All @@ -60,21 +66,29 @@ 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 r TemplateName
```
vendor/bin/mtrgen rm TemplateName

## Acknowledgement

This project would not be possible without [Nette](https://nette.org)'s [`php-generator`](https://github.com/nette/php-generator) package, which is used for the final code generation itself to output the finished PHP file.
# Repair the global store (remove all templates that don't exist)
vendor/bin/mtrgen repair
vendor/bin/mtrgen r
```

## License

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"require": {
"php": ">=8.1",
"nette/php-generator": "^4.0",
"nette/php-generator": "^3.0 || ^4.0",
"symfony/console": "^6.2",
"nette/neon": "^3.3",
"nette/safe-stream": "^3.0",
Expand All @@ -44,7 +44,7 @@
"prefer-stable": true,
"config": {
"platform": {
"php": "8.1"
"php": "8.2"
}
},
"funding": [
Expand Down
Loading

0 comments on commit fed37d3

Please sign in to comment.