Composer is a dependency manager for PHP. It allows you to declare the dependent libraries for your project needs. It is used in all modern PHP frameworks and it is one of the most recommended tools that solves fundamental issue in the majority of web projects.
In this article I will guide you how you can install composer on your Linux Systems.
Composer solves the below problems:
- Resolve dependency for PHP packages
- Auto-loading solution for PHP packages
- It keep all packages up to date.
Follow the below commands to install composer.
# mkdir /download #cd /download
Now download composer.phar file.
# curl -sS https://getcomposer.org/installer | php # ls -l total 1800 -rwxr-xr-x 1 root web1 1836198 Mar 29 03:55 composer.phar
Now move it to /usr/local/bin/.
# mv composer.phar /usr/local/bin/composer
Sometime above command may fail because the usr directory doesn’t exist. In this case create the directory structure first and then move the file as usual.
# which composer /usr/local/bin/composer
Now you can use the composer command globally.
I hope this article will help to install composer on CentOS/RHEL/Fedora systems. If you have any queries and problem please comment in comment section.