MTRGen

Generate your source code files automatically with ease!

2 followers

MTRGen is a file generator engine that can generate source code files from templates using a simple CLI utility. Create re-usable templates by adding <% variables %> anywhere in your file and have the content change dynamically based on the arguments.
MTRGen gallery image
Free
Launch tags:Productivity•Open Source•Developer Tools
Launch Team
Flowstep
Flowstep
Generate real UI in seconds
Promoted

What do you think? …

Matronator
Maker
📌
Hi everyone! I would love to introduce you to my latest project MTRGen. It is a file generator engine that can generate source files from generator templates using a simple CLI utility. Generator templates are just regular source files enhanced with placeholder variables and they are run through a custom template parser which enables some extra features using a special syntax. You can define template variables (or template parameters) anywhere in the template. Variables are wrapped in <% and %> with optional space on either side (both <%nospace%> and <% space %> are valid) and the name must be an alphanumeric string with optional underscore/s (must match this regex [a-zA-Z0-9_]+?). You can optionally provide filter to a variable by placing the pipe symbol | right after the variable name and the filter right after that (no space around the | pipe symbol), like this: <% variable|filter %>. The filter can be either one of built-in filters or any PHP function with the variable used as the function’s argument (if we have <% foo|strtoupper %> in the template and we provide an argument ['foo' => 'hello world'], the final (parsed) output will be this: HELLO WORLD). Now when the parser reads the template, it finds these variables and use them as arguments for the CLI tool during the generation process. You can then assign any value you want to these parameters during generation. The tool will automatically ask you to provide values for the arguments if you don’t provide any in the initial command. Thank you for checking it out and I'd love to read your feedback and thoughts about the project. Have a great day!