Add or update components

A contributing developer updates components by specifying components and their versions in Magento’s composer.json.

To update components if you’re not a contributing developer, see Updating the Magento application and components.

You can either add a require section to composer.json or you can use the composer require command as follows:

  1. Log in to the Magento server, or switch to, the Magento file system owner.
  2. Change to the directory to which you cloned the Magento application. For example,

    1
    
     cd /var/www/magento2
    

You have the following options:

Get available module versions

Command usage:

1
composer show --all <vendor>/<name>

For example,

1
composer show --all example/module

Use the composer require command to install

Command usage:

1
composer require <vendor>/<name>:<version>

For example:

1
composer require example/module:1.0.0

Wait while Composer updates dependencies and installs the component.

Add a require section to composer.json

Open composer.json in a text editor.

Add a require section like the following:

1
2
3
4
"require": {
  "<vendor>/<name>": "<version>",
  "<vendor>/<name>": "<version>"
}

Save your changes to composer.json, exit the text editor, and enter composer update

Related topics

If you have issues, see Composer troubleshooting.

If you have issues, see Composer troubleshooting.