Magento 2 uses Composer, a PHP dependency manager, to package components and product editions.
Composer reads a composer.json file in Magento’s root directory to download third-party dependencies listed in the file.
The Component Manager uses the composer.json file in an extension’s root directory to perform the following actions:
- The Component Manager can update, uninstall, enable, or disable an extension if installed using Composer (including from Packagist, Magento Marketplace, or other source) and it has a composer.json file.
- The Component Manager can still enable or disable an extension not installed using Composer (e.g. custom code) if it has a composer.json file.
We recommend you include composer.json in your component’s root directory even if you do not intend to distribute it to other merchants using Magento.