Here is a basic introduction to Composer in its most basic form. If we look at the docs it says:
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
Composer is part of the PHP tooling ecosystem. This is similar to node's npm and ruby's bundler, these tools help us manage project dependencies. All these tools pull from a central repository. Packagist is the main Composer repository. It aggregates public PHP packages installable with Composer.
The project dependencies are declared in a text file (usually json). For this, Composer uses a composer.json file. These files make it easier for all the project contributors to download the files required for the project. A great side effect of using such a tool is that you don't need to check in the third party code into source control. Because your repo is no longer bloated with third party code, each new developer could pull down the project in a matter of seconds. The only thing a new developer would need to do is run
composer install and have all the dependencies downloaded into their vendor directory.
These tools specify what to add to your .gitignore file in the documentation. If not, you can usually find something here. The link is a collection of useful .gitignore templates.
If you would like to see this in action, I recommend watching Meet Composer on Laracasts.