For that you must follow these simple steps I used it in Unbutu 16.04.
First, update the package manager cache by running:
sudo apt-get update
Now, let's install the dependencies. We will need curl to download Composer and php-cli to install and execute it. The php-mbstring package is necessary to provide functions for a library that we are going to use. git is used by Composer to download project dependencies and decompress to extract compressed packages. Everything can be installed with the following command:
sudo apt-get install curl php-cli php-mbstring git unzip
then you install it with the curl in this way:
curl -sS https://getcomposer.org/installer -o composer-setup.php
Next, run a short PHP script to verify that the installer matches the SHA-384 hash for the last installer found on the Composer Public Keys / Signatures page. You should make sure to replace the last hash value with the value highlighted below:
php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
To install composer globally, use the following:
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
This will download and install Composer as a system-wide called composer
, in / usr / local / bin.
All settings correct for using Composer
Downloading 1.1.1 ...
Composer successfully installed to: / usr / local / bin / composer
Use it: php / usr / local / bin / composer
and now you can try it with this command:
composer
I should show you something like this:
Output
______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ '__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 1.1.1 2016-05-17 12:25:44
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
-n, --no-interaction Do not ask any interactive question
--profile Display timing and memory usage information
--no-plugins Whether to disable plugins.
. . .