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,

    cd /var/www/magento2
    

You have the following options:

Use the composer require command

Command usage:

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

For example,

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:

	"require": {
		"<vendor>/<name>": "<version>",
		"<vendor>/<name>": "<version>"
	}

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

For more information

If you have issues, see Composer troubleshooting.