Install composer in linux

Posted by

The main goal of Composer, a popular PHP dependency management tool, is to simplify the installation and updating of project dependencies. Based on the project parameters, it will identify which extra packages are needed for a particular project and install them for you using the appropriate versions. Composer is also often used for bootstrapping new projects that are based on popular PHP frameworks such as Symfony and Laravel.

Step 1: Visit the following website to download

Run this command

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

step 2:

Run this command

php -r "if (hash_file('sha384', 'composer-setup.php') === 'e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

Then run this command

php composer-setup.php

Then run this command this command

php -r "unlink('composer-setup.php');"

Final step: move composer file in bin directory

sudo mv composer.phar /usr/local/bin/composer
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x