This is a beta release of documentation for Magento 2.4, published for previewing soon-to-be-released functionality. Content in this version is subject to change. Links to the v2.4 code base may not properly resolve until the code is officially released.
You must install Elasticsearch before installing Magento Commerce or Magento Open Source 2.4.0. See Elasticsearch for details.

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:

Get available module versions

Command usage:

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

For example,

composer show --all example/module

Use the composer require command to install

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

Related topics

If you have issues, see Composer troubleshooting.

If you have issues, see Composer troubleshooting.