Add repository section to Magento composer.json file with the following command. Path refers to the location of your module’s repository (or just local folder).
composer config repositories.robert-empty path ./local-src/robert-empty/
Then create composer.json, registration.php and etc/module.xml for the module. Manually, just copy from another module and update the content.
Then tell composer to install our module by referring to the package name defined in composer.json “name” field. This creates symlink with module repository to vendor folder.
composer require robert/module-empty
Then enable module. this command adds the module to app/etc/config.php file. List of modules to load and their load order. In database moduls are registered to setup_module
table.
php bin/magento module:enable Robert_Empty && php bin/magento setup:upgrade
You can skip the first part of the command because setup:upgrade
automatically enables new modules.
registration.php – makes the module visible.
etc/module.xml – lists depencencies in sequence node that have to be loaded first.