Kindly provide me a role of composer.json in magento2 in brief.

How to use composer.json file in Magento 2 and what is its main role in project?


closed as too broad by Keyur Shah, Manthan Dave, Siarhey Uchukhlebau, liyakat, Amit Bera Aug 21 '17 at 9:30

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


You can get more details about whats the role of composer in magento 2 and how its install in magento 2 using below link,

Composer in magento 2 bu Inviqa

Mainly Magento 2 use the Composer to management of modules and the core library which are used in magento 2 like Zend,Symfony,sebastian,phpunit.

Composer is a dependency manager for magento 2.

Composer declare the libraries of your project which are depends on your projects So its useful in your project if you have so many libraries or modules.

you can check composer.json file in root of your project.


What is Composer?

Composer is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries. Composer Website

Role of Composer in Magento 2

Composer reads a composer.json file in Magento’s root directory to download third-party dependencies listed in the file.

It is useful when modules are to be enable/disabled or completely removed. For example, your module depends on CMS, and if you attempt to disable CMS, it will throw and error since your module depends on it, and is active.

Read Full Info in Magento 2 Docs


To put is simply it is configuration file for Composer. Composer is a program that you can use on your server. Composer will consume composer.json file to install new modules to your project. Though Magento comes pre-installed with many modules you can install new once on top. Composer can also be used to update your modules to later versions. It will pull latest code from location specified in composer.json file.

Not the answer you're looking for? Browse other questions tagged or ask your own question.