Menu du compte de l'utilisateur

  • Log in

Navigation principale

  • Home Page
  • All CMS
  • Tutorials
  • White Paper
Home
Guide CMS

Breadcrumb

  • Home
  • Tutorials
  • Drupal User Guide
  • Chapter 3. Installation
  • 3.5. Using Composer to Download and Update Files

Language selector

  • Français
  • English

Main navigation

  • Home Page
  • All CMS
  • Tutorials
  • White Paper

User login

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
  • Create new account
  • Reset your password

Book navigation

  • Tutorials
    • Drupal User Guide
      • Preface
      • Chapter 1. Understanding Drupal
      • Chapter 2. Planning Your Site
      • Chapter 3. Installation
        • 3.1. Preparing to Install
        • 3.2. Concept: Additional Tools
        • 3.3. Concept: Methods for Downloading and Installing the Core Software
        • 3.4. Setting Up an Environment with DDEV
        • 3.5. Using Composer to Download and Update Files
        • 3.6. Running the Interactive Installer
      • Chapter 4. Basic Site Configuration
      • Chapter 5. Basic Page Management
      • Chapter 6. Setting Up Content Structure
      • Chapter 7. Managing User Accounts
      • Chapter 8. Blocks
      • Chapter 9. Creating Listings with Views
      • Chapter 10. Making Your Site Multilingual
      • Chapter 11. Extending and Customizing Your Site

Guy Vigneault

3.5. Using Composer to Download and Update Files

By Guy Vigneault | 11:51 PM EDT, Fri September 05, 2025

Goal

Use Composer to download or update files and dependencies in the core software, or in add-on modules and themes.

Prerequisite knowledge

Section 3.3, “Concept: Additional Tools”

Site prerequisites

If you want to use Composer, it must be installed either on a local development server or your live site. See Section 3.3, “Concept: Additional Tools”.

Steps

If you are unable to install the Composer tool on your live server, you can follow the steps in any of the sections below on your local server, and then transfer any updated or added files to your live server. The recommended procedure is to make an archive or zip file of the new and changed directories, transfer the archive to your live server, delete the directories that have changed, and extract the archive. Make sure to check for updates and additions to the following files, in the root of your installation:

  • vendor directory
  • autoload.php
  • composer.json
  • composer.lock

Using Composer to download the core software

Follow these steps if you have not yet downloaded or installed the core software, and you want to use Composer to download both the core software and its external dependencies:

  1. At the command line, change to one level above the directory where you want the software to reside.
  2. Enter this command, where mydir is the directory you want to create:

    composer create-project drupal/recommended-project mydir
  3. The latest release of the core software will be downloaded to the mydir/web sub-directory.

Using Composer to download a module or theme

Follow these steps if you are already using Composer to manage the core software, and you want to use Composer to add a contributed module or theme with its dependencies.

  1. Each time you want to add a contributed module or theme, determine the project’s short name. This is the last part of the URL of the project page; for example, the Geofield module, at https://www.drupal.org/project/geofield, has short name geofield.
  2. To download the contributed module or theme, along with its external dependencies, enter the following command at the root of your site (substituting the short name of the module or theme for geofield):

    composer require drupal/geofield

Using Composer to update previously-downloaded files

Follow these steps to update the files for the core software or a contributed module or theme, after having already started to manage dependencies with Composer:

  1. Determine the short name of the project you want to update. For the core software, it is core. For contributed modules and themes, it is the last part of the URL of the project page; for example, the Geofield module, at https://www.drupal.org/project/geofield, has short name geofield.
  2. If you want to update to the latest stable release, use the following command, substituting the short name of the project to be updated for geofield:

    composer update drupal/geofield --with-dependencies
  3. If you need a specific version, determine how to enter the version number you want to update to. For example, for version 8.x-1.16 of a contributed module, you would enter just the 1.16, and for the core software version 9.0.7, you would enter 9.0.7. Then enter the following command at the root of your site (substituting the short name of the project for geofield and the correct version number):

    composer require drupal/geofield:1.16

Expand your understanding

You can learn more about Composer commands by using Composer’s built-in help system. For example, to learn more about the create-project command, enter composer help create-project in your command window.

Videos

Using Composer and Git to Download Files

Additional resources

  • Drupal.org community documentation page "Using Composer to manage Drupal site dependencies"
  • Drupal.org community documentation page "Update Drupal core via Composer"
  • Drupal.org community documentation page "Add Composer to an existing site"

Attributions

Adapted by Jennifer Hodgdon, Hans Fredrik Nordhaug, and Joe Shindelar at Drupalize.Me from "Using Composer to manage Drupal site dependencies", copyright 2000-2025 by the individual contributors to the Drupal Community Documentation.

 

Book traversal links for Tutorials

  • ‹ 3.4. Setting Up an Environment with DDEV
  • Up
  • 3.6. Running the Interactive Installer ›
CMS

 

All CMS

 

Tuto

 

Tutorials

 

White Paper

 

White Paper

Powered by Drupal

Privacy Policy

Privacy Policy

 

Recent content

  • 11.4. Finding Themes
    2 days 19 hours ago
  • 11.3. Downloading and Installing a Module from Drupal.org
    2 days 19 hours ago
  • 11.2. Enabling and Disabling Maintenance Mode
    2 days 19 hours ago
  • 11.1. Finding Modules
    2 days 19 hours ago
  • Chapter 11. Extending and Customizing Your Site
    2 days 19 hours ago

Copyright

Creative Commons

Sauf mention contraire, Guide CMS © 2025 par Guy Vigneault est sous licence Creative Commons Attribution - Utilisation non commerciale - Partage dans les mêmes conditions 4.0 International

 

Creative Commons

Unless otherwise stated, Guide CMS © 2025 by Guy Vigneault is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License

eGV Web