Asking this same question on stack overflow got some downvotes. Guess people really don’t want you to do this.

My main reason was because I don’t want at extra requirement, shell access, for users.

https://stackoverflow.com/questions/27726794/php-composer-git-gitignore-and-one-step-install