Can anyone provide me Magento2 Documents that from where i can learn to develop modules for Magento2 -
i new magento2 have experience in magento. found structure of magento2 completly different. can provide me magento2 document how create module in magento2.
thank you
at basic, new magento2 module requires 3 files.
/etc/module.xml composer.json registration.php
i have created modules in /app/code
folder, in case create vendor folder (using name of choosing) , within module folder (again, name of choosing). example, full path /app/code/vendorname/modulename
.
within module folder, add 1 additional folder called /etc
.
with folder structure created, need add contents of 3 files, replacing vendorname , modulename names set above.
/app/code/vendorname/modulename/etc/module.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="urn:magento:framework:module/etc/module.xsd"> <module name="vendorname_modulename" setup_version="0.1.0" /> </config>
/app/code/vendorname/modulename/composer.json
{ "name": "vendorname/module-modulename", "description": "", "type": "magento2-module", "version": "0.1.0", "license": [], "require": { "php": "~5.6.0", "magento/magento-composer-installer": "*" }, "extra": { "map": [ [ "*", "vendorname/modulename" ] ] } }
/app/code/vendorname/modulename/registration.php
<?php \magento\framework\component\componentregistrar::register( \magento\framework\component\componentregistrar::module, 'vendorname_modulename', __dir__ );
with 3 files in place, final step register module magento running bin/magento setup:upgrade
on command line in root of magento installation.
after that, should see module listed in bin/magento module:status
or "stores > configuration > advanced > advanced" on backend.
from there can start adding controllers, models, observers, plugins, etc. quick web search should surface bunch of tutorials creating more useful modules, should visit official magento2 documentation start.
Comments
Post a Comment