Tuesday, 14 August 2018

Create a module Magento 2

1) Create folder in app/code/<Vender>/<ModuleName>, For Example using Vendor as Mywork and ModuleName as HelloWorld
2) Declear module by creating module.xml in app/code/Mywork/HelloWorld/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="Mywork_HelloWorld" setup_version="1.0.0" />
</config>
3) Register the module by registration.php in app/code/Mywork/HelloWorld/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Mywork_HelloWorld',
    __DIR__
);
4) Run command: php bin/magento setup:upgrade

No comments:

Post a Comment