What is Composer and how to install it?

What is Composer and how to install it

In this blog, we will discuss about what is composer and how to install it. In simple words, it is a dependency manager or you can say application-level package manager for PHP. It is used to install and manage application dependencies.

It was developed by Nils Adermann and Jordi Boggiano.

For composer you need to install PHP first.

So, basically we have two ways to install it on our local machine-

  • Windows installer – This is the simple way to download and install composer in your local machine. You need to download and run the .exe setup file. Here is the path to download and run file – Download Here. This will run the latest version of composer.

  • CLI (Command Line Installation) – Using CLI, you just open cmd in your local machine and follow below commands step by step –
    • To download Composer to local directory – php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”
    • Verify the installer SHA-384 – php -r “if (hash_file(‘sha384’, ‘composer-setup.php’) === ‘756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”
    • Run the installer – php composer-setup.php
    • Verify the setup has been install locally – php composer.phar

Source – Composer

Related blogs – Database connection in PHP

Like us on Facebook and Linkedin for more updates.

Back To Top