How To Install Composer On Ubuntu
Composer is a package manager for PHP.
Most PHP frameworks and projects utilize its feature for updates. Learn more at Composer’s official website.
You need curl to download composer and you need php to run composer.
sudo apt update && sudo apt upgrade -y sudo apt install php7.4-cli curl
wget and apt-utils have nothing to do with composer, but I commonly use them in these tutorials, now would be a good time to install them. Feel free to skip this step.
sudo apt-get install -y wget apt-utils git php-intl
Installing composer is really easy, you just need to run the following one liner:
sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Download’s the installer from the official website and installs it to the global bin directory as just ‘composer’. It requires root permissions for install.
To list available commands for composer use list:
To install the defined dependencies for your project, run the install command.
You can see packages available for download by going to Packagist.