The Magento application uses Composer packages to distribute, install, and upgrade components in an application instance.
To package a component, you must:
- Create a Magento Composer file (composer.json).
- Register the component using registration.php
- Package and publish your component.
https://devdocs.magento.com/guides/v2.1/extension-dev-guide/package/package_module.html