How To Install and Use Composer on Ubuntu

Posted by

Introduction

Composer is a widely used PHP dependency management solution designed primarily to make project dependency installation and updates easier. It will determine which additional packages are required for a given project and install them for you using the relevant versions based on the project specifications. Composer is also frequently used for bootstrapping new projects built on well-known PHP frameworks like Laravel and Symfony.

Step 1: Go to https://getcomposer.org/download/

Command-line installation

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;"

Step 3: run this command

 php composer-setup.php

Step 4: run this command

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

Step 5: run this command

sudo mv composer.phar /usr/local/bin/composer

Finally all composer setup in done

Reference this video

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x