Install PHP Composer on Ubuntu: Difference between revisions

From WikiMLT
m (Стадий: 3 [Фаза:Разработване, Статус:Разработван]; Категория:PHP)
mNo edit summary
Line 1: Line 1:
<noinclude><!--[[Category:PHP|?]]-->{{ContentArticleHeader/PHP}}</noinclude>
<noinclude>{{ContentArticleHeader/Linux Server|toc=off}}{{ContentArticleHeader/PHP}}</noinclude>
== References ==
 
==Install Composer via Apt==
<syntaxhighlight lang="shell" line="1">
sudo apt update && \
sudo apt install composer


* ...
</syntaxhighlight>
Depending on the version of the OS the Composer's version could be relatively old.


* ...
== Install the latest version of Composer manually ==
<syntaxhighlight lang="shell" line="1">
sudo apt update
sudo apt install php-cli unzip
</syntaxhighlight><syntaxhighlight lang="shell" line="1">
cd ~/tmp && \
curl -sS https://getcomposer.org/installer -o composer-setup.php && \
HASH=$(curl -sS https://composer.github.io/installer.sig) && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer && \
composer -V
</syntaxhighlight>


== Section 1 ==
== References ==
...
*Digital Ocean: [https://www.digitalocean.com/community/tutorials/how-to-install-composer-on-ubuntu-20-04-quickstart <nowiki>How To Install Composer on Ubuntu 20.04 [Quick-start]</nowiki>]


*Digital Ocean: [https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-20-04 How To Install and Use Composer on Ubuntu 20.04]
<noinclude>
<noinclude>
<div id='devStage'>
<div id="devStage">
{{devStage  
{{devStage  
  | Прндл  = PHP
  | Прндл  = PHP

Revision as of 00:33, 28 July 2022

In­stall Com­pos­er via Apt

sudo apt update && \
sudo apt install composer

De­pend­ing on the ver­sion of the OS the Composer's ver­sion could be rel­a­tive­ly old.

In­stall the lat­est ver­sion of Com­pos­er man­u­al­ly

sudo apt update
sudo apt install php-cli unzip
cd ~/tmp && \
curl -sS https://getcomposer.org/installer -o composer-setup.php && \
HASH=$(curl -sS https://composer.github.io/installer.sig) && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer && \
composer -V

Ref­er­ences