Composer lets you manage the dependencies of your project. But first of all, are you building a application or a library? If it's a application, you should upload the composer.lock to your version control. If it's a library, you should not do it. The vendor folder should never be part of your version control or uploaded to your server (find why here).
Basically:
- Set the composer.json file, with all your dependencies, project name, description, etc.
- Install composer in your machine, getcomposer.org has great tutorials on how to do this. (Composer also has the composer.phar which is basically the composer app in a single file. Download it and use
php composer.phar [command...] instead just composer).
- Inside the project root, run
composer install (or php composer.phar install if you have the composer.phar in your project). All of your dependencies will be installed, generating the vendor folder and updating the composer.lock if it already exists or creating it if not.
The composer.lock tells you about each dependency in your project. That is why you put it in the version control of an application, because you want to run the same version of the dependencies on your local machine and on your server.
And you don't do this with libraries, because you don't know what other developers' dependencies will be when they use your library.