How to Install Composer, simple, easy and no fluff
The composer is a dependency management tool for use with PHP ecosystems. Think of Composer as npm or yarn when working with Nodejs. Installing Composer should not be a headache. So let’s jump right in :)
Step One: Download Composer Installer
Download composer by running the following commands from your terminal:
$ curl -sS https://getcomposer.org/installer | sudo php
These two commands:
Uses curl to download composer.phar from https://getcomposer.org to home path, then we use | pipe and pass the composer.phar to php to execute it.
Step Two: Move Composer to your local binaries directory
This makes Composer available from the terminal globally, regardless of the directory you are in.
$ sudo mv composer.phar /usr/local/bin/composer
Verify that Composer is successfully installed by running:
composer # gives the following output
Congratulations! You have successfully installed Composer.
Note
Ensure that you have both curl and PHP installed. Avoid running Composer as root user.
This works for a vps scenario, you only need to ssh into the vps from your terminal.
That’s it. Let me know if you are still stuck. There are plenty of blog articles regarding installing composer, but they seem rather complicated. Thanks for following along.