Most of the PHP projects at inspireminds use Composer for PHP package and dependency management. It allows you to declare the packages your project depends on and it will manage (install/update) them for you - as well as any packages that those depend on etc.
The main documentation of Composer can be found here: https://getcomposer.org/doc/. This page will serve as a quick reference for the most used tasks.
Typically once you have checked out the code for a project from its repository, you will need to install its PHP dependencies first. You can do so with this simple command (assuming you have installed Composer globally):
$ composer install
This will install the dependencies according to the composer.lock file, when present. That file contains information about which packages need to be installed and in which exact version. It is created after a composer update operation for example.
To update all dependencies, you can run the following command:
$ composer update
This will instruct Composer to check for any version updates of any package and its dependencies. This is a complex task - Composer will do SAT solving on the “depenendency tree”, to figure out which versions of which packages can and cannot be installed. If an installable set of packages can successfully be determined, that information is written into the composer.lock file. This means you can re-construct the exact dependency state of an application at a later that with the help of that file, ensuring that everyone in the team is using the same version of all dependencies (unless they run an update again or install a new package of course).
If your task requires you to add a new package, you can do this by runing the following command:
$ composer require vendor/package-name
Of course, Composer doesn’t just “know” about these packages. By default, any public package must be published to the public Packagist, a service for providing information about available packages and its versions. Composer reads from that service and tries to find the package you are requiring. It then checks the required dependencies and if all checks out adds the required package to the composer.json and installs the package.