How To Install Composer

How To Install Composer

By : Laravellogic Created : July 3, 2019 View : 37

Hello Friend, Today in this tutorial you will learn how to install the composer and how to use it in future PHP projects. Just follow this step by step guide.

Composer not a package Also 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.

*Installation in Windows 7 8 or 10:

Download composer setup to install latest version of composer:-  https://getcomposer.org/Composer-Setup.exe 

Now you just need to set the environment variable before composer run the command

Are you set environment variable path? if not set environment variable path please go to this link -  https://phperrorcode.com/post/view/set-php-environment-variables-windows-xampp-or-wamp-example

 *Installation in ubuntu/linx

run the following command in your terminal. To automate the installation in composer

sudo apt-get update
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Following below command to check composer install or not 

composer
Output
how-to-install-composer

 

Note: Update all dependencies of project, please  goto Your project directory and use the following Command
composer update

If you want to know more about the composer then you can go to the composer official side. - https://getcomposer.org/download/

If any question, add below comment.