...
Let’s go through each of these steps in detail.
Create the module folder
Let’s create the folder app/code/Learning and inside this folder place another folder: FirstUnit. If you're using the command line, the code would be:
...
Module name:
Learning_FirstUnit
(based on the folders we created)Dependency: Magento_Catalog. We could have multiple dependencies. In this case, we would put
<module name=”..” />
nodes under the sequence node.
Create the registration.php file
Each module must have this file, which tells Magento how to locate the module. Continuing our example, create the file app/code/Learning/FirstUnit/registration.php
. Then put the following content into it:
...
The only thing that varies is the module name, which in our case is Learning_FirstUnit
.
Run the “setup:upgrade” command
Running this command makes your new module active, notifying Magento of its presence.
...
It should echo a large amount of output, one line of which should be Learning_FirstUnit
. Verify that this line of code is there.
Check that the new module is active¶
So far, we haven't added any useful code to our module – it is still empty (and therefore invisible). In order to verify that it has been recognized, check the file app/etc/config.php
. It has a list of auto-generated modules that are active.
...