Monday, July 26, 2021

How To Install PHP Composer 2 on Ubuntu 18.04 & 16.04

How To Install PHP Composer 2 on Ubuntu 20.04 & 21.04

Introduction~

In this tutorial we will show you composer 2.X installation on Ubuntu

Composer is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries.

 

Step 1) Launch the terminal and run following cmd.

$ sudo apt-get update

 
$
cd ~


 

Step 2) Download Composer Installer by following cmd.

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


 

Step 3) Verify composer is Downloaded 

Note :- If OutPut Showing "installer corrupt" then Use Command From Composer Offically Website https://getcomposer.org/download/

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


 

Step 4) Run Composer Installer by following cmd.

$ php composer-setup.php


 

Step 5) Remove the Composer Installer file

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


 

Step 6) Verify composer.phar is installed

$ ls


 

Step 7) Move Composer to /usr/bin/composer

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


 

Step 8) Check Composer version 

$ composer -v



No comments:

Post a Comment

testing