Composer is a tool for managing dependencies in PHP, and I would not like to confuse it with a package manager. It creates a composer.json file that contains all the dependencies needed to run your project and then installs them in the vendor folder. I assume you are familiar with this tool, but a refresh is welcome anytime, by accessing this link.
How do I install it on linux?
1. Make sure you have everything you need to install the composer.
sudo apt update
sudo apt install wget php-cli php-zip unzip
2. Download the Composer installer.
wget -O - https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Composer is now installed on your system.
How do you check?
composer -n -V
Composer version 2.0.7 2020-11-13 17:31:06
# composer require vendor/package
Easy! This command will add a new mandatory dependency in composer.json, implicitly in your project. And of course you can add a specific version of an addiction in case you have any conflicts.
# composer install
Even if you didn't use the composer require command, this command will install the entire dependency package for a project, and I'm sure you've already done so.
# composer update
Abuse this command! Keep your project up-to-date with all technologies and the latest versions of addictions.
Or you can use it to update a package namely composer update vendor / package.
# composer outdated
You will be surprised how many outdated packages you can project. Try it!
# composer remove
If you choose to delete a specific dependency, you can use:
composer remove vendor/package
# composer dump-autoload
You have created a service, a provider, or simply added a few classes to the project, just do your magic. With this command, you tell the composer where to find them.