Introduction
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
Requirements
CentOS7/RHCE7
cURL
PHP (including php-cli)
Installation
The installation process of Composer is relatively simple. First, let’s get in the good habit of updating our server.
# sudo yum -y update
Switch into the temp directory.
# cd /tmp
Install Composer using cURL
# sudo curl -sS https://getcomposer.org/installer | php
Want to make Composer globally accessible?
# mv composer.phar /usr/local/bin/composer
Conclusion
Composer 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. Thus, it is a dependency manager. It does however support a “global” project for convenience via the global command.
Composer is an essential tool for any PHP developer. It is very easy to install and you will save countless hours over the years automating your dependencies. Happy developing!