webkul / code-generator
webkul/code-generator
module lets you generate models, controller, helpers in seconds so that you can focus more on application logic
Code Generator For Magento2
Installation
composer require webkul/code-generator
php -f bin/magento setup:upgrade
User Guide
Usage
- To create new Module
php bin/magento generate:code Module_Name --type=new-module
- To create models
php bin/magento generate:code Module_Name --table="table_name" --type=model --name=ModelName
If you have created the db_schema file for the table in the above command, it will automatically create setter and getter of all the columns in the schema.
- To create repositories
php bin/magento generate:code Module_Name --type=repository --name=RepositoryClassName --model-class=ModelClassFullName --collection-class=CollectionClassFullName
- To create controller
php bin/magento generate:code Module_Name --type=controller --name=ControllerName --area=frontend|adminhtml --path=RelativeToModuleControolerFolder --router=RouteName
- To create helper
php bin/magento generate:code Module_Name --type=helper --name=HelperName
- To create payment method
php bin/magento generate:code Module_Name --type=payment --name=MethodName --payment-code=PaymentMethodCode
- To create shipping method
php bin/magento generate:code Module_Name --type=shipping --shipping-code=custom_shipping
- To create Plugin
php bin/magento generate:code Module_Name --type=plugin --name=PluginName --plugin=FullClassName [--area=frontend|adminhtml]
- To create observer
php bin/magento generate:code Module_Name --type=observer --name=ObserverName --event=event_name [--area=frontend|adminhtml]
- To create cron
php bin/magento generate:code Module_Name --type=cron --name=CronName [--schedule="0 1 * * *"]
- To create unit test cases
php bin/magento generate:code Module_Name --type=unit-test
- To create view
php bin/magento generate:code Module_Name --type=create-view --name=webkul_index_index --area=adminhtml --block-class=Main --template=hello.phtml --layout-type=admin-2column-left
--block-class, --template, --layout-type are optional.
- To create logger
php bin/magento generate:code Module_Name --type=logger [--name=loggerfile]
- To create command
php bin/magento generate:code Module_Name --type=command --name=CommandClass --command='test:hello'
- To override/rewrite a class (Block, Model, Controller)
php bin/magento generate:code Module_Name --type=rewrite --name=ClassName --rewrite='OverriddenClass' [--path=RelativeToModuleFolder]
- To create email template
php bin/magento generate:code Module_Name --type=email --name="Email Label" [--id="module_email_test"] [--template="test"]
- To create Ui Grid Listing
php bin/magento generate:code Module_Name --type=ui_component_listing --name="test_test" [--columns_name="test_column"] [--model_class_name="Model Class Name"][--table="Table Name"]
- To create Ui Component Form
php bin/magento generate:code Module_Name --type=ui_component_form --name="test_test_form" [--provider_name="Data Provider Name"] [--model_class_name="Model Class Name"] [--fieldset_name="Field Set Name"] [--fieldset_label="Field Set Label"] [--submit_url="Form Submit Url"] [--form_field="Form Fields in Json Format"]
Ex : form_field = '[{"field_name": "test_input_field", "field_type": "input", "field_label": "Test Input Field", "is_required": "true"}, {"field_name": "test_image_field", "field_type": "imageUploader", "field_label": "Image Uploader", "is_required": "false", "image_upload_url": "test/test/upload"}]'
No changelog yet
The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.
| Version | Stability | QA Status | Compatibility | Released |
|---|---|---|---|---|
| 2.0.8 | stable | Fail | Magento 2.4.7-2.4.8 Details | 2024-05-13 12:06:22 |
| 2.0.7 | stable | Not tested | Not yet tested Details | 2023-06-07 09:38:35 |
| 2.0.6 | stable | Not tested | Not yet tested Details | 2023-03-29 13:30:44 |
| 2.0.5 | stable | Not tested | Not yet tested Details | 2020-01-03 09:57:50 |
| 2.0.4 | stable | Not tested | Not yet tested Details | 2019-12-20 10:09:04 |
| 2.0.3 | stable | Not tested | Not yet tested Details | 2019-12-19 13:44:07 |
| 2.0.2 | stable | Not tested | Not yet tested Details | 2019-12-19 11:06:48 |
| 2.0.1 | stable | Not tested | Not yet tested Details | 2019-12-09 09:12:52 |
| 2.0.0 | stable | Not tested | Not yet tested Details | 2019-12-09 09:11:18 |
| 1.0.0 | stable | Not tested | Not yet tested Details | 2019-11-26 16:50:24 |
No dependencies declared
This package's composer.json doesn't declare any required, suggested, replaced, or conflicting packages.
Compatibility
Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.
Code Quality
Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.
Static analysis
Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.
| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Fail | 22 | 1 error, 21 warnings (ruleset: Magento2) — 7 auto-fixable with phpcbf |
| PHPMD | Warning | 145 | 145 rule violations (MissingImport:104, UnusedLocalVariable:28, ExcessiveMethodLength:4, UnusedFormalParameter:4, NPathComplexity:2) |
| Cpd | Warning | 1 | 1 duplicated chunk spanning 64 total lines (min-lines=5, min-tokens=70) |
| Composer validate | Info | 1 | valid; 1 advisory note (composer validate --strict) |
PHPStan
Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.
Tests
Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.
Unit tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Integration tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Security
Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.
More from webkul
View vendorTurn an existing module into recurring revenue.
If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.