PHPackages                             staempfli/magento2-code-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. staempfli/magento2-code-generator

AbandonedStaempfli-mage-tool[Utility &amp; Helpers](/categories/utility)

staempfli/magento2-code-generator
=================================

Staempfli AG - Magento 2 Code Generator Tool

1.11.2(6y ago)2453.7k54[6 issues](https://github.com/staempfli/magento2-code-generator/issues)[1 PRs](https://github.com/staempfli/magento2-code-generator/pulls)GPL-3.0PHP

Since Oct 12Pushed 5y ago27 watchersCompare

[ Source](https://github.com/staempfli/magento2-code-generator)[ Packagist](https://packagist.org/packages/staempfli/magento2-code-generator)[ RSS](/packages/staempfli-magento2-code-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (30)Used By (0)

Magento 2 Code Generator Tool
=============================

[](#magento-2-code-generator-tool)

[![Project Status: Abandoned – Initial development has started, but there has not yet been a stable, usable release; the project has been abandoned and the author(s) do not intend on continuing development.](https://camo.githubusercontent.com/14a8e7234bd98508cfd9903b34d873f772f8bad5efc410eddd157e9561fa51e6/687474703a2f2f7777772e7265706f7374617475732e6f72672f6261646765732f6c61746573742f6162616e646f6e65642e737667)](http://www.repostatus.org/#abandoned)[![License](https://camo.githubusercontent.com/dbc7239c6bd0fa96c9c25589a46a3eb6fa0113f0dcc4e42d7ee3967f4c5bbef1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f737461656d70666c692f6d6167656e746f322d636f64652d67656e657261746f722e737667)](https://packagist.org/packages/staempfli/magento2-code-generator)[![Version](https://camo.githubusercontent.com/9b6c60b2fb6e7124300bbfc0751e28a2ac128e40f486f01c3ecde7c9ce6727ca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f737461656d70666c692f6d6167656e746f322d636f64652d67656e657261746f722e737667)](https://packagist.org/packages/staempfli/magento2-code-generator)[![Code Climate](https://camo.githubusercontent.com/a96a82aed6c95d61017f109ff1ed0096ca8b034242efbe43c73ab38be2949851/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f6769746875622f737461656d70666c692f6d6167656e746f322d636f64652d67656e657261746f722e737667)](https://codeclimate.com/github/staempfli/magento2-module-spreadsheet/)[![Total Downloads](https://camo.githubusercontent.com/f9516f420c03378eb4aa9ce6c29af8452996584e6a11f0008ca031bfcb5aa19d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f737461656d70666c692f6d6167656e746f322d636f64652d67656e657261746f722f746f74616c2e737667)](https://packagist.org/packages/staempfli/magento2-code-generator)

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

[](#installation)

### Option1: Downloading .phar

[](#option1-downloading-phar)

```
wget https://github.com/staempfli/magento2-code-generator/releases/download//mg2-codegen.phar
chmod +x ./mg2-codegen.phar
# use the command globally on your system
sudo mv ./mg2-codegen.phar /usr/local/bin/mg2-codegen

```

### Option2: Using Composer

[](#option2-using-composer)

Install globally on your system with the following command:

```
composer global require "staempfli/magento2-code-generator"

```

Just make sure you have the composer `bin` dir in your `$PATH`. The default value is `~/.composer/vendor/bin/`

Note: if you have dependency problems with other projects installed globally, we recommend you to use [consolidation/cgr](https://github.com/consolidation/cgr)

Usage
-----

[](#usage)

1. List all templates: `mg2-codegen template:list`
2. Generate template: `mg2-codegen template:generate `

**NOTE**:

- `template:generate` command must be executed on the module root folder where the `registration.php` file is. You can also use option `--root-dir` to specify this path, if you execute it from a different location.
- When creating a new `module`, you must create first the module parent folder and execute the command from there.

Demo
----

[](#demo)

[![Video Demo](docs/img/video-demo.gif)](docs/img/video-demo.gif)

You can also watch a more detailed video demos on Youtube:

- [Create a CRUD EAV Module in just 5 minutes](https://www.youtube.com/watch?v=f8qBnOIRIs4)
- [Playlist Tutorials](https://www.youtube.com/playlist?list=PLBt8dizedSZCxuqK41vG01_MngJQPRuMj)

Available Templates
-------------------

[](#available-templates)

```
Featured
  ajaxHtml
  consoleCommand
  crudEAV
  crudEAVWithFile
  frontController
  requireJs
  logger
  widget

More Templates
  ajaxJson
  ajaxRestApi
  blockHtml
  crud
  crudEAVWithMultipleFiles
  customConfigXml
  customDBConnection
  email
  emailFormRequest
  fileEAVAttribute
  fileEAVMultiple
  fileModel
  fileProcessor
  fotoramaSlider
  language
  model
  module

```

Create new Templates
--------------------

[](#create-new-templates)

### Clone and Install Project

[](#clone-and-install-project)

For that you cannot use the `.phar` binary, so you need to install the project:

- [Clone and Install](docs/clone-install.md)

### Contribute with new Templates

[](#contribute-with-new-templates)

- If you want to contribute with new templates, just follow this manual:

    1. [How to create templates](docs/createTemplates.md)

### Private Templates

[](#private-templates)

If current templates do not fill your needs, you can easily create your own templates. Just follow the manual:

- [How to create private templates](docs/privateTemplates.md)

Prerequisites
-------------

[](#prerequisites)

- PHP &gt;= 5.6.\*

Developers
----------

[](#developers)

- [Juan Alonso](https://github.com/jalogut)

Licence
-------

[](#licence)

- **Software tool:** free software under the terms of [GNU General Public License, version 3 (GPLv3)](http://opensource.org/licenses/gpl-3.0)
- **Generated code:** free to use, copy, modify or distribute under the terms of the [Free Public License 1.0.0](https://opensource.org/licenses/FPL-1.0.0)

Copyright
---------

[](#copyright)

(c) 2016 Staempfli AG

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community27

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 95.3% 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 ~43 days

Recently: every ~155 days

Total

27

Last Release

2359d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/402069?v=4)[Marcel Hauri](/maintainers/mhauri)[@mhauri](https://github.com/mhauri)

![](https://www.gravatar.com/avatar/71706506f6589b5436c45edfcf1ae57d8ced0d5571c06fdd48cf97d41b0bbcb8?d=identicon)[staempfli-webteam](/maintainers/staempfli-webteam)

![](https://www.gravatar.com/avatar/0039026286692f2f4f9df99a2625870ca1b157114920093ce0ff89fb5756e064?d=identicon)[audef1](/maintainers/audef1)

---

Top Contributors

[![jalogut](https://avatars.githubusercontent.com/u/6410900?v=4)](https://github.com/jalogut "jalogut (162 commits)")[![rev42](https://avatars.githubusercontent.com/u/681069?v=4)](https://github.com/rev42 "rev42 (3 commits)")[![audef1](https://avatars.githubusercontent.com/u/4160004?v=4)](https://github.com/audef1 "audef1 (1 commits)")[![piotrkwiecinski](https://avatars.githubusercontent.com/u/2151333?v=4)](https://github.com/piotrkwiecinski "piotrkwiecinski (1 commits)")[![telmiger](https://avatars.githubusercontent.com/u/3194567?v=4)](https://github.com/telmiger "telmiger (1 commits)")[![julienanquetil](https://avatars.githubusercontent.com/u/1108170?v=4)](https://github.com/julienanquetil "julienanquetil (1 commits)")[![gfernandes410](https://avatars.githubusercontent.com/u/5921857?v=4)](https://github.com/gfernandes410 "gfernandes410 (1 commits)")

---

Tags

magento2

### Embed Badge

![Health badge](/badges/staempfli-magento2-code-generator/health.svg)

```
[![Health](https://phpackages.com/badges/staempfli-magento2-code-generator/health.svg)](https://phpackages.com/packages/staempfli-magento2-code-generator)
```

###  Alternatives

[friendsofphp/pickle

Installer for PHP extension, supports pecl package or install from src tree directly

1.7k3.3k](/packages/friendsofphp-pickle)

PHPackages © 2026

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