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') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { 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');"
or
sudo php /tmp/composer-setup.php --install-dir=/usr/bin --filename=composer

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
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
trackback

[…] install composer by using this […]

1
0
Would love your thoughts, please comment.x
()
x