Kamil Orzechowski
Kamil Orzechowski

Reputation: 91

Force composer.json to export vendor repositories instead of cloning

I am using Symfony2 for PHP Development and it is awesome framework.

I am using it now for making solid template for making my new web - applications. (A company framework built on top of symfony2).

I got a problem with vendor libraries. I am using git for hosting my project, and, when I enter dependencies in composer.json and call update, it clone whole repositories, with whole history of every library. Even worse, those repositories are subrepositories to my main repository, and files in those libraries won't commit. After trying to clone project on another computer it won't work because of lack of vendor libraries. I just want to force composer to export contents of the repositories instead of cloning it. I want pure files, not the repository.

I am of course can using composer.json forever, but I want to make my boilerplate functional, even if github will stop work. And another reason, that I am editing this project from two separate machines, and I need all my files in project in repository, calling 2 times per day composer.json update and waiting 5 minutes every time is not funny.

Upvotes: 3

Views: 1584

Answers (2)

Cagatay Gurturk
Cagatay Gurturk

Reputation: 7246

Within your repository, you're committing composer.json file that will tell the composer install needed dependencies. There is no need to commit vendor/* folder and enlarge your repository size. The cleaner way: All the developers that checkout your repository should run composer update to download missing files. And your deploy scripts should run a composer update after deploying.

Please read: https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md

Upvotes: 0

Shon M
Shon M

Reputation: 174

What you're looking for is probably the --prefer-dist option which will download a zip (when available) instead of repository, which you can then commit.

Upvotes: 1

Related Questions