Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/webkul/magento2-code-generator
https://github.com/webkul/magento2-code-generator
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/webkul/magento2-code-generator
- Owner: webkul
- License: mit
- Created: 2019-11-22T14:48:38.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-13T12:06:22.000Z (6 months ago)
- Last Synced: 2024-08-31T23:39:03.175Z (2 months ago)
- Language: PHP
- Size: 152 KB
- Stars: 41
- Watchers: 5
- Forks: 16
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Code Generator For Magento2
# Installation
``` composer require webkul/code-generator ```
``` php -f bin/magento setup:upgrade ```
# User Guide
- [Magento 2 Code Generator](https://webkul.com/blog/magento-2-code-generator/)
# 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"}]' ```