Install Composer on Debian

Updated on November 21, 2023
Install Composer on Debian header image

Introduction

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

In this tutorial, we will be outlining the process of installing Composer globally on Debian Linux.

Requirements

  • Debian 6, 7 or 8
  • PHP (including php-cli)
  • Curl

Installation

The Composer installer is a single PHP Script, which makes the process quick and easy. Below are the steps to follow in order to install Composer:

cd /usr/src
curl -sS https://getcomposer.org/installer -o composer-setup.php
php composer-setup.php --install-dir=/usr/local/bin --filename=composer

You can test Composer by running the command below: composer --version

You can also test Composer's functionality by creating a sample Laravel location in your current directory using the command below:

composer create-project --prefer-dist laravel/laravel test

As a result of running the above command, a directory named testshould be created. To ensure that Composer worked as intended, navigate to the directory and confirm that it isn't empty.

This concludes our tutorial, thank you for reading.