Composer is a dependency management tool for PHP similar to npm for Node.js and bundle for ruby. It is not a package manager in the same sense as Yum or Apt are. Yes, it deals with “packages” or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project. By default it does not install anything globally. It does however support a “global” project for convenience via the global command. It permits you to declare the subordinate libraries your task needs and it will install them in your project for you.
Let’s start installing it on VPS imaged with CentOS 7:
First of all we have to stay system up-to-date.
yum -y update
Now installing Composer. We have to download it via:
[root@kenga /]# curl -sS https://getcomposer.org/installer | php All settings correct for using Composer Downloading... Composer (version 1.3.1) successfully installed to: //composer.phar Use it: php composer.phar
As the process completed, we can do the ‘composer.phar’ file executable by running the following command:
[root@kenga /]# chmod +x composer.phar
Now use the following commands to make composer available globally for all users in your system, which can be used for all php applications on that system:
[root@kenga /]# mv composer.phar /usr/local/bin/composer
You can also check the version of composer by running bellow command:
[root@kenga /]# composer -V
And it shows:
Composer version 1.3.1 2017-01-07 18:08:51
Done! We have successfully installed PHP Composer on CentOS 7 VPS. Check Composer website for extensive documentation how to use PHP Composer on your CentOS 7 system.