Install Composer

By xngo on September 4, 2020

Install Composer is easy. You simply download the latest binary file(*.phar) from https://getcomposer.org/download/. Set it executable and then run it.

# Download the latest version.
    wget https://getcomposer.org/composer-stable.phar
 
# Make it executable.
    chmod +x composer-stable.phar
 
# Move it to path where you can run it anywhere.    
    mv composer-stable.phar /usr/local/bin/composer
 
# Test it out. It should show the version number.
    composer --version

Examples

Here are some examples on how to install Drupal modules using Composer.

# Install Markdown module.
    cd DRUPAL_ROOT_DIR
    composer require 'drupal/markdown:^2.0'
 
# Install GeSHi Filter for syntax highlighting module.
    cd DRUPAL_ROOT_DIR
    composer require 'drupal/geshifilter:^1.3'        

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.