Friday, September 9, 2016

Practical Magento 2: Create a custom Module - minimal structure

There is no need to create a custom module structure from the scratch manually. Using this great tool helps to make creation process faster:

1. download and install n98-magerun2 as described on above link.

2. navigate to Magento root directory using terminal 3. running command:

$ n98-magerun2.phar dev:module:create
will display the following message with instructions about parameters that can be used for Module creation:

dev:module:create [-m|--minimal] [--add-blocks] [--add-helpers] [--add-models] [--add-setup] [--add-all] [-e|--enable] [--modman] [--add-readme] [--add-composer] [--author-name[="..."]] [--author-email[="..."]] [--description[="..."]] vendorNamespace moduleName
For minimal module structure, we can run:

 $ n98-magerun2.phar dev:module:create -m Apiworks Minimal
which will produce the following output:

<config xmlns:xsi="" xsi:nonamespaceschemalocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Apiworks_Minimal" setup_version="1.0.0">


Read more
, , ,