Composer is a package-level application manager for the PHP programming language that provides tools for managing dependencies within a PHP application.

You will need to connect to the console via SSH, in the case of Windows, for example using Putty.

To install PHP composer, go to the folder and download the executable:

cd /usr/local/src && curl -sS https://getcomposer.org/installer | php  

If you don't have curl, you can download it:

php -r "readfile('https://getcomposer.org/installer');" |  

Now use the following commands to make composer globally available to all users on your system, which can be used for all PHP applications on that system:

mv composer.phar /usr/local/bin/composer  

Options for the composer installer

** -install-dir**

You can install composer to any folder using the "-install-dir" option and the path to the folder. For the example "-install-dir=bin" you can use the following command:

curl -sS https://getcomposer.org/installer | php -- --install-dir=bin  

-filename

You can specify the name of the file (by default it is composer.phar) using the "-filename" parameter. For example:

curl -sS https://getcomposer.org/installer | php -- --filename=composer  

You can combine the top two options on one line for ease of use:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer  

-version

You can install composer of a specific version using the "-version" parameter with the version. For example:

curl -sS https://getcomposer.org/installer | php -- --version=1.0.0-alpha10  

Set permissions on the file:

chmod +x /usr/local/bin/composer  

Or (if you have not renamed the file):

chmod +x /usr/local/bin/composer.phar  

Let's see what version we have installed:

composer -V  

Setting dependencies

Run this at the root of the project:

composer init  

or

php composer.phar init  

After which we execute:

composer install  

The installation is now complete.

Updated July 30, 2018