PHPackages                             orba/magento2-codegen - 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. orba/magento2-codegen

Abandoned → [lingaro/magento2-codegen](/?search=lingaro%2Fmagento2-codegen)Library[Utility &amp; Helpers](/categories/utility)

orba/magento2-codegen
=====================

Magento 2 Code Generator

3.4.0(3y ago)779.0k18[1 issues](https://github.com/ORBA/magento2-codegen/issues)MITPHPPHP ~7.4.0 || ~8.1.0

Since Jun 12Pushed 1y ago8 watchersCompare

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

READMEChangelog (1)Dependencies (22)Versions (17)Used By (0)

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

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

Created by [Lingaro](https://lingarogroup.com)

Inspired by

Purpose
-------

[](#purpose)

In day-to-day Magento 2 development there are some common tasks which require development of repeatable code that is hard to simply copy-paste. The purpose of this app is to automatize creation of such code, so the developers may focus on business logic and thanks to that being much more efficient and happy.

There are other tools on the market that allows to generate Magento boilerplate code, but we went a step further. The unique value of our tool is that it can be used with already existing codebase. The code generated by the tool is automatically merged with current code (eg. configuration XML files, requirejs-config JS files, etc.). Also, our aim was to generate high-quality code that uses modern PHP features and Magento coding standards.

Demo
----

[](#demo)

New entity with all admin CRUD actions in just a minute? Why not ;-)

### Console command

[](#console-command)

[![Console command](demo/console.gif)](demo/console.gif)

### Generated code

[](#generated-code)

[![Generated code](demo/ide.gif)](demo/ide.gif)

### Admin panel

[](#admin-panel)

[![Admin panel](demo/browser.gif)](demo/browser.gif)

Supported Magento versions
--------------------------

[](#supported-magento-versions)

- 2.4.0
- 2.4.1
- 2.4.2
- 2.4.3
- 2.4.4
- 2.4.5

Watchout: Minimal version of Magento's PHP is 7.4.

Available templates
-------------------

[](#available-templates)

`apiEndpoint` - creates an API endpoint

`block` - creates a block and phtml template file for it

`cache` - creates a cache type

`categoryAttributes` - creates data patches which add custom attributes to category entity along with ui\_component needed to render these attributes

`configField` - creates config field for already existent group of store configuration

`configGroup` - creates group for already existent section of store configuration

`configSection` - creates section in existent tab of store configuration

`configTab` - creates tab for store configuration

`consoleCommand` - creates a console command

`cron` - creates a cron job and (optionally) a cron group

`crud` - creates new entity and all CRUD actions in the admin panel for it

`customerAttributes` - creates data patches which add custom attributes to customer entity

`emailTemplate` - creates a system e-mail template with class for sending it and config for allowing admin to customize it

`eventObserver` - creates event observer for given event

`frontPageController` - creates a frontend controller that renders custom page

`frontPostController` - creates a very basic front POST controller

`importEntity` - creates an import model to import data into your custom entity table

`jsMixin` - creates a JS mixin

`jsModule` - creates a JS module

`model` - creates a model with the corresponding repository, searchResult, resourceModel, collection, db\_schema.xml and APIs

`module` - creates basic configuration needed to start a custom module

`productAttributes` - creates data patch which adds custom attributes to product entity

`queueMessage` - creates queue message with publisher and handler using AMQP connection

`quoteFields` - creates custom fields for quote and order

`searchCriteriaUsage` - creates a management class and search criteria usage

`theme` - creates basic configurations needed to start a custom theme

`viewModel` - creates a view model and phtml template file for it

`widget` - creates a widget

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

[](#installation)

Recommended way to install this app is to add it as Magento's Composer dev dependency:

```
composer require --dev lingaro/magento2-codegen

```

If you don't want to attach this app to your Magento, you can also simply clone the repository and use it as a standalone library. Don't forget to run `composer install` to install all required dependencies.

Configuration
-------------

[](#configuration)

Create your custom config file (not needed for Lingaro developers) either in package `config` directory or in your Magento root directory:

```
cp vendor/lingaro/magento2-codegen/config/codegen.yml.dist vendor/lingaro/magento2-codegen/config/codegen.yml

```

or

```
cp vendor/lingaro/magento2-codegen/config/codegen.yml.dist codegen.yml

```

and edit default values.

You may add your own template directory by including the following in your `codegen.yml`:

```
templateDirectories:
  - { path: "path/to/templates" }

```

Template folder `path` must be relative to package directory, ex. if you want to add private templates to your Magento `dev` folder, you should use `../../../dev/codegen_templates` path.

You may include multiple template directories.

To overwrite a core template just copy a core template to your template directory and make changes as necessary.

Usage
-----

[](#usage)

1. List all templates:

```
bin/codegen template:list

```

2. Show template info:

```
bin/codegen template:info

```

3. Generate template:

```
bin/codegen template:generate

```

For templates which type is `module` (most of them) this command must be executed on the module root folder where the `registration.php` file is.

For templates which type is `root` this command must be executed on the Magento root folder.

Example:

```
cd /path/to/magento/app/code/Lingaro/TestModule
../../../../vendor/bin/codegen template:generate block

```

3.1. Options

Long nameShort nameDescriptionExample--root-dir-rIf specified, code is generated on this root directory. If the directory doesn't exist, it will be created automatically.`bin/codegen -r"/var/www/magento/app/code/Lingaro/TestModule" template:generate block`--force-merge-mUse "all" to automatically run all code mergers. Use "experimental" to automatically run non-experimental code mergers.`bin/codegen template:generate -mall block`--force-override-oIf specified, all unmerged files will be automatically overridden.`bin/codegen template:generate -o block`--yaml-path-yIf specified, property values will be collected from YAML file instead of console prompts.`bin/codegen -y"lib/internal/codegen/templates/block/.no-copied-config/example.yml" template:generate block`Contribution
------------

[](#contribution)

Feel free to contribute with new templates, bugfixes and features. Submit your code to review using pull request.

Be aware that we require all the code to be compatible with PSR12. Also, we are validating the code with the following PHPMD rule sets: cleancode, codesize, controversial, design, unusedcode.

In [dev/docs.md](dev/docs.md) you can find the additional documentation for developers.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~76 days

Recently: every ~168 days

Total

15

Last Release

1096d ago

Major Versions

1.1.3 → 2.0.02020-08-10

2.3.0 → 3.0.02021-07-14

PHP version history (3 changes)1.0.0PHP ~7.2

3.0.0PHP ~7.4

3.4.0PHP ~7.4.0 || ~8.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/13911a5750ce8b70677c6792e103f7fbb14670a9c0463f43000acb6472707080?d=identicon)[lingaro](/maintainers/lingaro)

![](https://www.gravatar.com/avatar/88e52d1984a4a5089d35d43dc0479bd58d29cedd17d531b90607c8252813ef7b?d=identicon)[pavlo.vasheniuk](/maintainers/pavlo.vasheniuk)

---

Top Contributors

[![michalbiarda](https://avatars.githubusercontent.com/u/1135380?v=4)](https://github.com/michalbiarda "michalbiarda (102 commits)")[![janusz-witrykus-orba](https://avatars.githubusercontent.com/u/60344804?v=4)](https://github.com/janusz-witrykus-orba "janusz-witrykus-orba (40 commits)")[![pvasheniuk-lingaro](https://avatars.githubusercontent.com/u/129160337?v=4)](https://github.com/pvasheniuk-lingaro "pvasheniuk-lingaro (24 commits)")[![michal-biarda-orba](https://avatars.githubusercontent.com/u/81220778?v=4)](https://github.com/michal-biarda-orba "michal-biarda-orba (24 commits)")[![sszymkowicz](https://avatars.githubusercontent.com/u/12847344?v=4)](https://github.com/sszymkowicz "sszymkowicz (19 commits)")[![kamil-sulek-orba](https://avatars.githubusercontent.com/u/60348583?v=4)](https://github.com/kamil-sulek-orba "kamil-sulek-orba (18 commits)")[![pavlo-vasheniuk-orba](https://avatars.githubusercontent.com/u/72542473?v=4)](https://github.com/pavlo-vasheniuk-orba "pavlo-vasheniuk-orba (17 commits)")[![aliasgar-bharmal-orba](https://avatars.githubusercontent.com/u/100674498?v=4)](https://github.com/aliasgar-bharmal-orba "aliasgar-bharmal-orba (7 commits)")[![mateusz-scislowski-orba](https://avatars.githubusercontent.com/u/82796936?v=4)](https://github.com/mateusz-scislowski-orba "mateusz-scislowski-orba (5 commits)")[![slawomir-szymkowicz-orba](https://avatars.githubusercontent.com/u/60344219?v=4)](https://github.com/slawomir-szymkowicz-orba "slawomir-szymkowicz-orba (4 commits)")[![piotr-francuz-orba](https://avatars.githubusercontent.com/u/60348578?v=4)](https://github.com/piotr-francuz-orba "piotr-francuz-orba (3 commits)")[![marcin-dzdza-lingaro](https://avatars.githubusercontent.com/u/58724484?v=4)](https://github.com/marcin-dzdza-lingaro "marcin-dzdza-lingaro (2 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/orba-magento2-codegen/health.svg)

```
[![Health](https://phpackages.com/badges/orba-magento2-codegen/health.svg)](https://phpackages.com/packages/orba-magento2-codegen)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[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)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[shopware/platform

The Shopware e-commerce core

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

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)

PHPackages © 2026

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