For Registering our custom module, we need to create a php file named
registration.php in the root of our custom folder and write the below given code
\Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, '_', __DIR__ );
if examine this code then you will see that after the name of module there is a
__DIR__ variable which is a php variable to identify the current working directory, it means that you can register your module from any where in Root of magento directory.
Enjoy this Article, don’t miss to comment us or write us if you need to know more about magento2