Composer is a dependency management tool for PHP similar to npm for nodejs and bundle for ruby. Using the composer tool we can define required libraries for our project and install it with the composer in a single command. We don’t need to search for each library individually to install each time.
This tutorial will help you to install PHP Composer on Fedora 34/33/32/31/30 Linux. We are assuming that you already have installed PHP on your system.
- Sudo privileged account with shell access.
- You must have PHP installed on your system.
Install Composer on Fedora
PHP Composer is available as a binary file to directly download and use. Open the terminal and download the composer binary file using the curl command-line tool.
curl -sS https://getcomposer.org/installer | php
Now use the following commands to make composer available globally for all users in your system, which can be used for all PHP applications on that system.
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
To find the version of the composer simply use the following command. This will also show you the uses of the composer on the command line.
Yo will see the output like below:
______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 2.1.3 2021-06-09 16:31:20 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --profile Display timing and memory usage information --no-plugins Whether to disable plugins. -d, --working-dir=WORKING-DIR If specified, use the given directory as working directory. --no-cache Prevent use of the cache
If there is an upgrade available, Composer displays the information with every run. Composer is build with the ability to upgrade itself. You just need to run the following command to update composer.phar to the latest version.