A composer is a tool for dependency management in PHP. It allows the user to declare dependencies that your project will depend on and it will mange them for you. It is also commonly used to bootstrap new projects on PHP frameworks like Laravel.
In this tutorial, you will easily install a Composer on your Ubuntu 20.04 system.
Things you have to consider before installing a Composter:
- Your system should be running on Ubuntu 20.04.
- User should have root “sudo” privileges.
- Firewall is enabled on your server.
1.First thing is to update the package manager
2. Install required packages using this command:
3. Downloading and installing Composer, make sure that you are in your home directory, then retrieve the installer using curl:
4. Verify that the downloaded installer matches the SHA-384 has for the latest installer. To facilitate the verification step, you can use the following command to obtain the latest hash from Composer page and store it in a variable:
5. Next is we need to execute the PHP code that can be found in the Composer download page, to verify the installation script is safe to run and the output should be Installer Verified for us to say that it is safe:
6. Finally to test the installation you have to run:
There should be an output just like in the picture and there you have it. You have Composer now in your Ubuntu 20.04 system.