The PHP Composer is a package management tool. It removes the hassle of maintaining PHP packages for an application manually. You can easily install all the required packages using Composer. It maintains a list of required packages in a JSON file called composer.json.
This tutorial helps you to install and configure PHP composer on Debian 10 Buster, Debian 9 Stretch, and Debian 8 Jessie systems.
- Shell access to a running Debian system with sudo privilege.
- PHP must be installed and configured, version 5.3 or higher.
2. Install Composer on Debian
You can download composer script from getcomposer.org website by running the following command. It will create a composer.phar file in the current directory.
curl -sS https://getcomposer.org/installer | php
Copy composer.phar file under bin directory to make available anywhere in the system. Also, set the execute permission on file. I have changed the filename from composer.phar to composer to easy use.
mv composer.phar /usr/local/bin/composer chmod +x /usr/local/bin/composer
Type composer at the command prompt. This will provide you composer version details along with options available with composer command.
composer ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 1.8.5 2019-04-09 17:46:47 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output
3. Upgrade PHP Composer
The composer has the ability to upgrade itself without downloading again. Simply run below command from the terminal to upgrade compose on Debian.
sudo composer self-update