How To Install PHP Composer on CentOS 7

How To Install PHP Composer on CentOS 7

Composer is a dependency manager for PHP similar to npm for Node.js or pip for Python.

Composer pulls all the required PHP dependency packages for our project and manage them for us. It is used in all modern PHP frameworks and platforms such as Magento 2, Symfony and Drupal.

In this tutorial, we will go through the steps of installing and using Composer on a CentOS 7 machine.

The following prerequisites must be fulfilled before we continue with this tutorial:

The following steps describe how to install Composer on a CentOS 7 system.

We just need to download composer executable and put under bin directory.

# curl -sS | php

The following commands will make composer available globally for all users in our system, which can be used for all PHP applications on the system.

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

The last step is to verify the installation:

# composer

The command above will print the Composer’s version, commands, and arguments.

/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
Composer version 1.8.5 2019-04-09 17:46:47

command [options] [arguments]

This completes the Composer installation tutorial. Enjoy using Composer!

Safi Ahmed Choudhury

Safi Ahmed Choudhury

Safi is the founder and chief editor of ZoomTutorials Blog, a leading tutorials and technology blogging site specializing in DevOps, SysAdmin and Cloud Technologies to help IT professionals in their day to day work. He is a Senior Cloud and DevOps Solutions Engineer at a leading eCommerce development Company and has more than 8 years of SysAdmin experience working with Fortune 500 companies to solve their most important IT backbones. Safi lives in Hyderabad with his wife and a son.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.