How do Git and Composer work together?

I’m beginning to get comfortable with git and have used the basic commands of Composer as far as it relates to creation/installation of a project.

What I don’t understand is how the two tools (git and composer) can work together. Initially I thought why are there two, both can do many of the same things, can’t they? Now, I’m thinking Git is a development tool and composer is a deployment tool.

I guess my question is twofold:


[*]Is my hunch correct, git is for development and composer is for deployment?

[*]If true, what aspects of the development process should be managed with git and which with composer?


  1. Mostly yes.

  2. Everything should be managed with git except what’s under Composer’s control i.e. exclude vendor dir.

I’ve put my project locally into a Git repository. Then I noticed there a few subdirectories, mostly in the vendor directory, that are Git repositories themselves (yii, gii etc.) I thought it might be clever to add them as submodules into my own project. But now that you say the vendor directory should be excluded, I’m wondering if the submodule setup is a good way to go.

If you want to develop some packages locally and not rely on composer, it would be better to set up additional folder for extensions and autoload it. It doesn’t mean that it is a good idea to do this just to keep the things together in one place like in good old days.