As we’ve mentioned in the previous chapter, you should begin creating a new module by setting up three items:
1. A folder containing the module name and the name of the vendor or developer. For the purpose of the Academy, you’ll place the new module in the same directory where Magento is installed, in the app/code folder. You can do it by executing the following command. Make sure you are authorized to create files and folders in the following location: $ mkdir -p app/code/Snowdog/Academy
2. Adding the etc directory containing a module.xml
file
$ mkdir -p app/code/Snowdog/Academy/etc
$ touch app/code/Snowdog/Academy/etc/module.xml
3. Creating a registration.php
file
$ touch app/code/Snowdog/Academy/registration.php
The next step is executing the following command:
$ php bin/magento setup:upgrade
It activates the module and informs Magento mechanisms about that. After that, the information as to which modules the setup:upgrade
worked on will be displayed on the screen. One of those should be the Snowdog_Academy
module (it can also be a different name, depending on how you’ve named the module).
Next, by opening the app/etc/config.php file, you should be able to see an entry related to our module, along with information that it’s active.
‘Snowdog_Academy’ => 1
More information on creating new modules can be found in Magento documentation: https://devdocs.magento.com/videos/fundamentals/create-a-new-module/
Check our previous blog post from the series to learn about the module's structure.